Animation Class
A component class which holds animations and logic recquired to play them.
Constructor
Animation
()
Methods
add
-
handle
-
name
Registers a new animation. Overwrites previously registered animations with the same name.
Parameters:
-
handle
AssetHandleThe animation asset handle.
-
name
StringName of the animation. From now on, the animation will be referenced by this name within this component.
get
-
name
Retrieves a registered animation.
Parameters:
-
name
StringName of the animation.
Returns:
has
-
name
Checks whether an animation with the given name was registered.
Parameters:
-
name
StringName of the animation.
Returns:
play
-
name
-
[priority]
-
[rate]
-
[finishedCallback]
-
[callbackData]
Schedules playing of an animation. The new animation will be played if there's no animation currently playing or if the priority of the new animation is at least as high as the one currently playing. If the animation being played is the same as the currently playing animation, then only the rate, priority and callbacks will be set.
Parameters:
-
name
StringName of the animation.
-
[priority]
Number optionalThe animation's priority. A greater number signifies greater priority. If the priority is smaller than the priority of the currently playing animation, the new animation will not be played. If not provided, defaults to Number.NEGATIVE_INFINITY.
-
[rate]
Number optionalRate at which the new animation should be played. A rate of 0.5 means that the animation will play twice as fast as specified in the asset file, while a rate of 2 means that it'll play two times slower. If this value is not provided or is less than or equal to 0, then the rate will default to 1.
-
[finishedCallback]
Function optionalA function to be called when the animation finishes playing. The callback will not be called for looping animations (obviously) and animations that get overwritten by playing other animations before they can finish.
-
[callbackData]
Object optionalUser specified data for the callback.
remove
-
name
Removes a registered animation.
Parameters:
-
name
StringName of the animation.