Playable
Description:
A base class for an animation model system.
Class Object: Playable Class.
Inherits from: Node.
look
Type: Field.
Description:
The look of the animation.
Signature:
look: string
speed
Type: Field.
Description:
The play speed of the animation.
Signature:
speed: number
recovery
Type: Field.
Description:
The recovery time of the animation, in seconds. Used for doing transitions from one animation to another animation.
Signature:
recovery: number
fliped
Type: Field.
Description:
Whether the animation is flipped horizontally.
Signature:
fliped: boolean
current
Type: Readonly Field.
Description:
The current playing animation name.
Signature:
const current: string
lastCompleted
Type: Readonly Field.
Description:
The last completed animation name.
Signature:
const lastCompleted: string
getKey
Type: Function.
Description:
Get a key point on the animation model by its name.
Signature:
getKey: function(self: Playable, name: string): Vec2
Parameters:
Parameter | Type | Description |
---|---|---|
name | string | The name of the key point to get. |
Returns:
Return Type | Description |
---|---|
Vec2 | The key point value as a Vec2. |
play
Type: Function.
Description:
Plays an animation from the model.
Signature:
play: function(
self: Playable,
name: string,
loop?: boolean --[[false]]
): number
Parameters:
Parameter | Type | Description |
---|---|---|
name | string | The name of the animation to play. |
loop | boolean | [optional] Whether to loop the animation or not (default is false). |
Returns:
Return Type | Description |
---|---|
number | The duration of the animation in seconds. |
stop
Type: Function.
Description:
Stops the currently playing animation.
Signature:
stop: function(self: Playable)
setSlot
Type: Function.
Description:
Attaches a child node to a slot on the animation model.
Signature:
setSlot: function(self: Playable, name: string, item: Node)
Parameters:
Parameter | Type | Description |
---|---|---|
name | string | The name of the slot to set. |
item | Node | The node to set the slot to. |
getSlot
Type: Function.
Description:
Gets the child node attached to the animation model.
Signature:
getSlot: function(self: Playable, name: string): Node | nil
Parameters:
Parameter | Type | Description |
---|---|---|
name | string | The name of the slot to get. |
Returns:
Return Type | Description |
---|---|
Node|nil | The node in the slot, or nil if there is no node in the slot. |