Constructor
new FreeBlendState(optionsopt, blendStatesopt)
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
options |
Object |
<optional> |
{} | Options for the container state. |
blendStates |
Array.<AbstractState> |
<optional> |
[] | Blend states to be controlled by |
Extends
Members
(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}
Returns the weight of a state controlled by the container.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Name of the state to return the weight from. |
- Overrides:
Returns:
- Weight of the state.
- 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) → {Deferred}
Sets the weight of a state controlled by the container.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Name of the state to set the weight of. |
weight |
number | Weight value to set on the state. |
- 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: