diff --git a/sprite/clock/tween.go b/sprite/clock/tween.go index b319bd4..f5f2a03 100644 --- a/sprite/clock/tween.go +++ b/sprite/clock/tween.go @@ -14,10 +14,14 @@ var ( EaseInOut = CubicBezier(0.42, 0, 0.58, 1) ) +// Linear computes the fraction [0,1] that t lies between [t0,t1]. func Linear(t0, t1, t Time) float32 { - if t0 == t1 { + if t >= t1 { return 1 } + if t <= t0 { + return 0 + } return float32(t-t0) / float32(t1-t0) }