Interface: AnimationPlayerInterface

AnimationPlayerInterface

Class factory interface for controlling playback of a collection of animations.
One animation can be played at any given time, crossfading between animations
will result in playing a TransitionState.

Members

(readonly) currentAnimation :string

Gets the name of the state the layer is currently in control of.

Type:
  • string

(readonly) currentState :AbstractState

Gets the state the layer is currently in control of.

Type:

easingFn :function

Gets and sets the default easing function to use when transitioning and
setting weights.

Type:
  • function

(readonly) isTransitioning :boolean

Gets whether or not the layer is currently transitioning to a new animation.

Type:
  • boolean

(readonly) paused :boolean

Gets whether or not the player is updating states.

Type:
  • boolean

transitionTime :number

Gets and sets the default number of seconds it takes to transition to a new
animation.

Type:
  • number

Methods

(static) Mixin(BaseClassopt) → {Class}

Creates a class that implements AnimationPlayerInterface and extends
a specified base class.

Parameters:
Name Type Attributes Default Description
BaseClass Class <optional>
class{}

The class to extend.

Returns:

A class that extends BaseClass and implements AnimationPlayerInterface.

Type
Class

cancelAnimation() → {boolean}

Cancel playback of the current animation.

Returns:
Type
boolean

discard()

Discard the transition state.

pauseAnimation() → {boolean}

Pause playback of the current animation.

Returns:
Type
boolean

playAnimation(name, transitionTimeopt, easingFnopt, onFinishopt, onErroropt, onCancelopt, onNextopt) → {Deferred}

Start playback an animation from the beginning.

Parameters:
Name Type Attributes Description
name string

Name of the animation to play.

transitionTime number <optional>

Amount of time it will take before the
new state has full influence for the layer.

easingFn function <optional>

Easing function to use for blending if transitionTime
is greater than zero.

onFinish function <optional>

Function to execute when the animation finishes.

onError function <optional>

Function to execute if the animation encounters
an error during playback.

onCancel function <optional>

Function to execute if playback is canceled.

onNext function <optional>

Function to execute if an animation queue is
played and it advances to the next animation.

Returns:
Type
Deferred

resumeAnimation(nameopt, transitionTimeopt, onFinishopt, onErroropt, onCancelopt, onNextopt) → {Deferred}

Resume playback of an animation.

Parameters:
Name Type Attributes Description
name string <optional>

Name of the animation to resume playback for. Default
is the layer's current animation name.

transitionTime number <optional>

Amount of time it will take before the
new state has full influence for the layer.

onFinish function <optional>

Function to execute when the state finishes.

onError function <optional>

Function to execute if the state encounters
an error during playback.

onCancel function <optional>

Function to execute if playback is canceled.

onNext function <optional>

Function to execute if an animation queue is
played and it advances to the next animation.

Returns:
Type
Deferred

stopAnimation() → {boolean}

Stop playback of the current animation.

Returns:
Type
boolean

update(deltaTime)

Update the current animation.

Parameters:
Name Type Description
deltaTime number

Time in milliseconds since the last update.