CAAT.Interpolator

Interpolator object instances are used mainly in CAAT.Behavior objects to define the way they are applied.

The default interpolator applied to any Behavior is a linear ramp, that is, the Behavior is applied in regular time increments.

A CAAT.Interpolator object has the ability to modify this linearity, and apply Behaviors differently, in example accelerating, exponentially, etc. Despite the interpolator function being applied, the behavior will apply for the range of values it had defined.

In CAAT an interpolator is an object with a function getPosition( time ) which returns an object of the form {x: time, y: float}. The time parameter is a value between 0 and 1, meaning 0 behavior's start time and 1 behavior's start time + duration.

Interpolators have a function setPingPong() which modifies the time parameter. If this method is called, the interpolator will take half application time to go from start to end values, the other half to go from end to start values.

Here you can see the visual representation of every defined CAAT.Interpolator. The x axis means behavior application time, and the y axis means the resulting value time to apply the behavior for.

Linear Interpolator

Instance interpolators are created by calling new CAAT.Interpolator().createLinearInterpolator

Inverse= false
Pinpong=false Pinpong=true

Linear Inverse Interpolator

Instance interpolators are created by calling new CAAT.Interpolator().createLinearInterpolator

Inverse= true
Pinpong=false Pinpong=true

Exponential Interpolator

Instance interpolators are created by calling new CAAT.Interpolator().createExponentialInInterpolator or new CAAT.Interpolator().createExponentialOutInterpolator or new CAAT.Interpolator().createExponentialInOutInterpolator.

The exponential interpolator, accepts two parameters. The exponent of the Interpolator function and the previously described pingpong boolean value.

Pinpong=false
Exponent ExponentialIn ExponentialOut ExponentialInOut
2
4
6
Pinpong=true
Exponent ExponentialIn ExponentialOut ExponentialInOut
2
4
6

Bounce Interpolator

Instance interpolators are created by calling new CAAT.Interpolator().createBounceInInterpolator or new CAAT.Interpolator().createBounceOutInterpolator or new CAAT.Interpolator().createBounceInOutInterpolator.

Pinpong=false
BounceIn BounceOut BounceInOut
Pinpong=true
BounceIn BounceOut BounceInOut

Elastic Interpolator

Instance interpolators are created by calling new CAAT.Interpolator().createElasticInInterpolator or new CAAT.Interpolator().createElasticOutInterpolator or new CAAT.Interpolator().createElasticInOutInterpolator.

Pinpong=false
Parameters ElasticIn ElasticOut ElasticInOut
amp=1.1, liquid=.4
amp=1.0, liquid=.2
Pinpong=true
Parameters ElasticIn ElasticOut ElasticInOut
amp=1.1, liquid=.4
amp=1.0, liquid=.2