Previous: , Up: Tweens   [Contents][Index]


4.2.4.2 Tweening

The tween procedure creates new procedures to be used for animation. For example, the code below creates a tween procedure that linearly interpolates (0, 0) to (10, 10) over the course of ten ticks.

(define t (tween vlerp ease-linear (vector2 0 0) (vector2 10 0) 10))

(t 5) ;; => (vector2 5 5)
Scheme Procedure: tween interpolator ease start end duration

Return a procedure that interpolates from start to end in duration ticks. The value returned for a given time is determined by applying ease with the time ratio to acquire an alpha value, and then applying interpolator with start, end, and alpha. alpha is a rational number in the range [0, 1].