1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-06-16 04:25:23 +00:00

cof: added Duration method

This commit is contained in:
M. Sz 2021-02-25 09:33:47 +01:00
parent e7c5efe8e4
commit 78404ed56c

View File

@ -14,3 +14,14 @@ func (c *COF) SpeedToFPS() float64 {
return fps
}
// Duration returns animation's duration
func (c *COF) Duration() float64 {
const (
milliseconds = 1000
)
frameDelay := milliseconds / c.SpeedToFPS()
return float64(c.FramesPerDirection) * frameDelay
}