Interpolate

Author: Fernando Zapata (fernando@cpudreams.com)

Description
Interpolation utility functions for easing, Bezier splines, and Catmull-Rom splines. Provides consistent calling conventions across these three interpolation types. Provides low level access via individual easing functions, for example EaseInOutCirc, Bezier, and CatmullRom. Provides high level access using sequence generators, NewEase, NewBezier, and NewCatmullRom. Functionality is available at different levels of abstraction, making the functions easy to use and making your own high level abstractions easy to build.

Usage
You can use the low level functions similar to how you might use Unity's built-in Mathf.Lerp.

Instead of hard coding the easing function you can use the Ease(EaseType) function to look up a concrete easing function.

You can also use higher level sequence generator functions to quickly build a reusable component. For example, this SplinePath component will move a GameObject smoothly along a path using Catmull-Rom to make sure the GameObject passes through each control point. Using the interpolation utility function this component takes less than ten lines of code (minus the visualization function OnDrawGizmos).



For the complete details on all available functions please read the doc comments. If you have any questions feel free to contact me directly at fernando@cpudreams.com.

Code
The code is organized top-down for easy reading.

Interpolate.js
Version C#: Andrea85cs 02:55, 5 April 2011 (PDT)