Class: Blend1dState

Blend1dState(optionsopt, blendStatesopt, blendThresholdsopt, phaseMatchesopt)

Class for blending N number of blend states based on a single
parameter.

Constructor

new Blend1dState(optionsopt, blendStatesopt, blendThresholdsopt, phaseMatchesopt)

Parameters:
Name Type Attributes Default Description
options Object <optional>

Options for the container state

blendStates Array.<AbstractBlendState> <optional>
[]

Blend states to be
controlled by this container.

blendThresholds Array.<number> <optional>
[]

Threshold values for activating
each blend state.

phaseMatches Array.<boolean> <optional>
[]

Booleans indicating whether or not
each blend state should be phase matched.

Extends

Members

blendValue

Gets and sets the blend parameter value.

blendValuePending

Gets whether or not the blend value is currently being animated.

(readonly) internalWeight :number

Gets the sum of internal weights of the sub-states.

Type:
  • number
Overrides:

Methods

cancel() → {boolean}

Cancel playback of the sub-states and cancel any pending promises.

Overrides:
Returns:
Type
boolean

discard() → {boolean}

Discards all sub-state resources.

Overrides:
Returns:
Type
boolean

getBlendThreshold(name) → {number}

Gets the threshold value of a blend with the corresponding name.

Parameters:
Name Type Description
name string

Name of the blend to get the threshold of.

Returns:

Threhold value.

Type
number

getBlendWeight() → {number}

Gets the user defined weight.

Overrides:
Returns:
Type
number

pause() → {boolean}

Pause playback of the sub-states. This prevents pending promises from being executed.

Overrides:
Returns:
Type
boolean

play(onFinishopt, onErroropt, onCancelopt) → {Deferred}

Start playback of the sub-states from the beginning.

Parameters:
Name Type Attributes Description
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.

Overrides:
Returns:
Type
Deferred

resume(onFinishopt, onErroropt, onCancelopt) → {Deferred}

Resume playback of the sub-states.

Parameters:
Name Type Attributes Description
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.

Overrides:
Returns:
Type
Deferred

setBlendThreshold(name, value) → {number}

Sets the threshold value of a blend with the corresponding name.

Parameters:
Name Type Description
name string

Name of the blend to set the threshold.

value number

Value of the threshold to set.

Returns:

Set threshold value.

Type
number

setBlendWeight(name, weight, secondsopt, easingFnopt) → {Deferred}

Updates the user defined weight over time.

Parameters:
Name Type Attributes Default Description
name null

Unused parameter.

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.

Overrides:
Returns:
Type
Deferred

stop() → {boolean}

Stop playback of the sub-states and resolve any pending promises.

Overrides:
Returns:
Type
boolean

update(deltaTime)

Update any values of the sub-states that need to be evaluated every frame.

Parameters:
Name Type Description
deltaTime number

Time in milliseconds since the last update.

Overrides:

updateInternalWeight(factor)

Multiplies the weight of each sub-state by a factor to determine the internal weight.

Parameters:
Name Type Description
factor number

0-1 multiplier to apply to the user weight.

Overrides: