Class: AnimationUtils

AnimationUtils

A collection of useful animation functions.

Methods

(static) clamp(value, minopt, maxopt) → {number}

Clamp a number between 2 values.

Parameters:
Name Type Attributes Default Description
value number

Value to clamp.

min number <optional>
0

Minumum value.

max number <optional>
1

Maximum value.

Returns:
Type
number

(static) interpolateProperty(propertyOwner, propertyName, targetValue, optionsopt) → {Deferred}

Return a deferred promise that can be used to update the value of a numeric
property of this object over time. Pass delta time in milliseconds to the
deferred promise's execute method in an update loop to animate the property
towards the target value.

Parameters:
Name Type Attributes Description
propertyOwner Object

Object that contains the property to animation.

propertyName string

Name of the property to animate.

targetValue number

Target value to reach.

options Object <optional>

Optional options object

Properties
Name Type Attributes Default Description
seconds number <optional>
0

Number of seconds it will take to reach
the target value.

easingFn function <optional>
Linear.InOut

Easing function to use for animation.

onFinish function <optional>

Callback to execute once the animation completes.
The target value is passed as a parameter.

onProgress function <optional>

Callback to execute each time the animation
property is updated during the animation. The property's value at the time of
the update is passed as a parameter.

onCancel function <optional>

Callback to execute if the user cancels the
animation before completion. The animation property's value at the time of
cancel is passed as a parameter.

onError function <optional>

Callback to execute if the animation stops
because an error is encountered. The error message is passed as a parameter.

Returns:

Resolves with the property's value once it reaches the
target value.

Type
Deferred