1. home

Frame-rate independent interpolation for Unity


Back in 2002, Robert Penner published his book, Robert Penner's Programming Macromedia Flash MX. The book was significant in that it unveiled a set of stand-alone "easing functions" for simple animation. You've probably seen these easing functions, they've been ported to every language and websites like easings.net are dedicated to them. These functions make it simple for programmers to apply various eases to tween-based animation. By "tween-based" I'm referring to keyframe animation: interpolation between two fixed points in time.

But what about animations that don't have a start time and an end time? Consider procedural animations that happen in a real-time environment, for example: "every frame ease a game object towards another game object". Those animations can't be keyframed; mathematically, we can't interpolate the in-between values (the 'tweens) if there is no definitive end to the animation.

Continue reading