Constructor
new TransitionState()
Extends
Members
(readonly) internalWeight :number
Gets the internal weight.
Type:
- number
- Overrides:
paused :number
Gets whether or not the state is currently paused.
Type:
- number
- Overrides:
weight :number
Gets and sets the user defined weight.
Type:
- number
- Overrides:
(readonly) weightPending :boolean
Gets whether or not the weight is currently being animated.
Type:
- boolean
- Overrides:
Methods
cancel() → {boolean}
Cancel playback of the state and cancel any pending promises.
- Overrides:
Returns:
- Type
- boolean
configure(currentStatesopt, targetStateopt, transitionTime, easingFnopt, onCompleteopt)
Update sub-states the transition is controlling and start new weight
animations on each one. This should be called each time the current state of
an animation layer gets updated to a new value and a transition time greater
that zero is specified.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
currentStates |
Array.<AbstractState> |
<optional> |
[] | States whose weight values |
targetState |
AbstractState |
<optional> |
State whose weight will be animated |
|
transitionTime |
number | Amount of time it will in seconds take for |
||
easingFn |
function |
<optional> |
Easing function to use for weight animations. |
|
onComplete |
function |
<optional> |
Function to execute once all weight animations |
deactivate()
Force the internal weight to 0. Should be called before switching or transitioning
to a new state.
- Overrides:
discard()
Cancel any pending promises and remove reference to them.
- Overrides:
pause() → {boolean}
Pause playback of the state. This prevents pending promises from being executed.
- Overrides:
Returns:
- Type
- boolean
play(onFinishopt, onErroropt, onCancelopt) → {Deferred}
Start playback of the state 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
reset(transitionTime, easingFnopt, onCompleteopt)
Start new weight animations state the transition controls. This should be called
if an animation is played with a transition time greater than zero and a transtion
to that animation was already in progress.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
transitionTime |
number | Amount of time it will in seconds take for |
|
easingFn |
function |
<optional> |
Easing function to use for weight animations. |
onComplete |
function |
<optional> |
Function to execute once all weight animations |
resume(onFinishopt, onErroropt, onCancelopt) → {Deferred}
Resume playback of the state.
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
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 |
easingFn |
function |
<optional> |
The easing function to use for interpolation. |
- Overrides:
Returns:
- Type
- Deferred
stop() → {boolean}
Stop playback of the state and resolve any pending promises.
- Overrides:
Returns:
- Type
- boolean
update(deltaTime)
Update any values 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 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. |
- Overrides: