Model
Description:
Another implementation of the 'Playable' record.
Class Object: Model Class.
Inherits from: Playable.
reversed
Type: Field.
Description:
Whether the animation model will be played in reverse.
Signature:
reversed: boolean
duration
Type: Readonly Field.
Description:
The duration of the current animation.
Signature:
const duration: number
playing
Type: Readonly Field.
Description:
Whether the animation model is currently playing.
Signature:
const playing: boolean
paused
Type: Readonly Field.
Description:
Whether the animation model is currently paused.
Signature:
const paused: boolean
hasAnimation
Type: Function.
Description:
Check if an animation exists in the model.
Signature:
hasAnimation: function(self: Model, name: string): boolean
Parameters:
Parameter | Type | Description |
---|---|---|
name | string | The name of the animation to check. |
Returns:
Return Type | Description |
---|---|
boolean | Whether the animation exists in the model or not. |
pause
Type: Function.
Description:
Pauses the currently playing animation.
Signature:
pause: function(self: Model)
resume
Type: Function.
Description:
Resumes the currently paused animation, or plays a new animation if specified.
Signature:
resume: function(
self: Model,
name?: string,
loop?: boolean --[[false]]
)
Parameters:
Parameter | Type | Description |
---|---|---|
name | string | [optional] The name of the animation to play. |
loop | boolean | [optional] Whether to loop the animation or not (default is false). |
reset
Type: Function.
Description:
Resets the current animation to its initial state.
Signature:
reset: function(self: Model)
updateTo
Type: Function.
Description:
Updates the animation to the specified time, and optionally in reverse.
Signature:
updateTo: function(
self: Model,
elapsed: number,
reversed?: boolean --[[false]]
)
Parameters:
Parameter | Type | Description |
---|---|---|
elapsed | number | The time to update to. |
reversed | boolean | [optional] Whether to play the animation in reverse (default is false). |
getNodeByName
Type: Function.
Description:
Gets the node with the specified name.
Signature:
getNodeByName: function(self: Model, name: string): Node
Parameters:
Parameter | Type | Description |
---|---|---|
name | string | The name of the node to get. |
Returns:
Return Type | Description |
---|---|
Node | The node with the specified name. |
eachNode
Type: Function.
Description:
Calls the specified function for each node in the model, and stops if the function returns false.
Signature:
eachNode: function(self: Model, func: function(Node): boolean): boolean
Parameters:
Parameter | Type | Description |
---|---|---|
func | function | The function to call for each node. |
Returns:
Return Type | Description |
---|---|
boolean | Whether the function was called for all nodes or not. |