cof: added Duration method

This commit is contained in:
M. Sz 2021-02-25 09:33:47 +01:00
parent e7c5efe8e4
commit 78404ed56c
1 changed files with 11 additions and 0 deletions

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
}