teaching machines

Interpolants in Twoville

October 4, 2019 by . Filed under public, twoville.

Shapes in Twoville are animated across time by interpolating their properties between keyframes. Time is a first-class concept in the language, with assignment statements storing values across a timeline rather than in a static memory cell.

Here’s a rectangle that oscillates left and right using this keyframe-sensitive assignment syntax:

The animation above uses linear interpolation. The rectangle moves at a constant speed; there’s no acceleration. Linear interpolation is the vanilla of animation. To add feelings of inertia and anticipation, we use other interpolants. I added a few of these this week!

Since interpolation describes how to blend between two keyframes, the interpolant or tween function must be set using the doubly-bound start -> t -> stop time interval.