This project is read-only.


Linear interpolation is great for basic functionality but it produces very mechanical results as object in real-life rarely move or change at a constant rate. Xen provides you with various interpolation functions to help you produce better results!

Using the Interpolator

The Interpolator is a static method that takes Start and End values (float, Vector2, Vector3, Vector4) and the current progress value to return the calculated value. It also supports varied progress periods, wrapping vs. clamping, and can take parameters specific to that function. Here's an example:
// Use a Circular interpolation with a progress of 0.5 with a period of 2.0 that wraps back to the beginning.
Vector2 interpolatedValue = Interpolator.Circular( Vector2.Zero, Vector2.One, 0.5f, 2.0f, true );

Interpolation Functions

Xen's Interpolator supports the following functions:
  • Step
  • Linear
  • Sine
  • Quadratic
  • Cubic
  • Exponential
  • Logarithmic
  • Circular
Each function (with a exception of Step and Linear) supports an In, Out, and InOut variation of the tween function as well. For more detail, refer to the Demo_Tweens demo.

Last edited Feb 7, 2011 at 2:32 AM by twohalf, version 1


No comments yet.