Constructor
new Blend2dState(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 |
blendThresholds |
Array.<Array.<number>> |
<optional> |
[] | Threshold values for activating |
phaseMatches |
Array.<boolean> |
<optional> |
[] | Booleans indicating whether or not |
Extends
Members
blendValueX
Gets and sets the x blend weight.
blendValueXPending
Gets whether or not the x blend value is currently being animated.
blendValueY
Gets and sets the y blend weight.
blendValueYPending
Gets whether or not the y 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
getBlendWeight(name) → {number}
Gets the user defined weight.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Name of blend 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 |
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 |
onCancel |
function |
<optional> |
Function to execute if playback is canceled. |
- Overrides:
Returns:
- Type
- Deferred
setBlendWeight(name, weight, secondsopt, easingFnopt) → {Deferred}
Updates the user defined weight over time.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
name |
string | Name of blend weight to update. |
||
weight |
number | Target weight value. |
||
seconds |
number |
<optional> |
0 | The amount of time it will take to reach the |
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: