Class: AnimationLayer

AnimationLayer(optionsopt)

Class for managing a set of animations where only one state can be active at
any given time.

Constructor

new AnimationLayer(optionsopt)

Parameters:
Name Type Attributes Description
options Object <optional>

Options for the animation layer.

Properties
Name Type Attributes Default Description
name string

Name of the layer. Names must be unique to the
animation feature that contains the layer.

blendMode LayerBlendModes <optional>
DefaultLayerBlendMode

Type of blending to use for all states controlled by the layer.

weight number <optional>
1

The amount of influence the layer's current
animation has over the result for the host.

transitionTime number <optional>
0

The default amount of time to use when
playing and resuming animations.

easingFn function <optional>

The default easing function to use when
transitioning between animations and setting layer weight.

Implements:

Members

(readonly) blendMode :string

Gets the type of blending used for states controlled by the layer.

Type:
  • string

weight :number

Gets and sets the amount of influence the layer's current animation has over
the result for the host.

Type:
  • number

(readonly) weightPending :boolean

Gets whether or not the layer's weight value is currently being animated.

Type:
  • boolean

Methods

discard()

Cancel any pending promises and discard states controlled by the layer.

Implements:

getAnimationBlendNames(animationName) → {Array.<string>}

Returns the names of blend states in an animation.

Parameters:
Name Type Description
animationName string

Name of the animation.

Returns:
  • Names of blend states.
Type
Array.<string>

getAnimationBlendWeight(animationName, blendName) → {number}

Returns the weight for a blend state of an animation.

Parameters:
Name Type Description
animationName string

Name of the animation containing the blend state
to update.

blendName string

Name of the blend state to retrieve the weight of.

Returns:
  • Weight of the blend state.
Type
number

pause() → {boolean}

Pause the current animation state and any interpolation happening on the layer's
weight property.

Returns:
Type
boolean

pauseWeight() → {boolean}

Pause any interpolation happening on the layer's weight property.

Returns:
Type
boolean

resume() → {boolean}

Resume the current animation state and any interpolation happening on the layer's
weight property.

Returns:
Type
boolean

resumeWeight() → {boolean}

Resume any interpolation happening on the layer's weight property.

Returns:
Type
boolean

setAnimationBlendWeight(animationName, blendName, weight, secondsopt, easingFnopt) → {Deferred}

Update the weight for a blend state of an animation.

Parameters:
Name Type Attributes Default Description
animationName string

Name of the animation containing the blend state
to update.

blendName string

Name of the blend state to update.

weight number

Weight value to set on the animation. This number shoudld be
in the 0-1 range.

seconds number <optional>
0

Number of seconds it should take to reach the new weight.
Default is zero and will set immediately.

easingFn function <optional>

Easing function to use while interpolating the new
weight. Default is Easing.Linear.InOut.

Returns:
  • Promise that will resolve once the animation's weight reaches
    the target value.
Type
Deferred

setWeight(weight, secondsopt, easingFnopt) → {Deferred}

Updates the user defined weight over time.

Parameters:
Name Type Attributes Default Description
weight number

The target weight value.

seconds number <optional>
0

The amount of time it will take to reach the
target weight.

easingFn function <optional>

The easing function to use for interpolation.

Returns:
Type
Deferred

update(deltaTime)

Update any weight interpolators and the current animation.

Parameters:
Name Type Description
deltaTime number

Time in milliseconds since the last update.

Implements:

updateInternalWeight(factor)

Multiplies the user weight by a factor to determine the internal weight.

Parameters:
Name Type Description
factor number

0-1 multiplier to apply to the user weight.