new SpriteAnimationManager(sprite)
Animation manager, handles animations for the FORGE.Sprite display class.
Parameters:
Name | Type | Description |
---|---|---|
sprite |
FORGE.Sprite | The Sprite attached to this animation manager. |
Extends
Members
(readonly) alive :boolean
Get the alive flag value of the object.
Type:
- boolean
- Inherited From:
- Source:
(readonly) className :string
Get the class name of the object.
Type:
- string
- Inherited From:
- Source:
data :*
Get and set any custom data you want to associate to this object.
Type:
- *
- Inherited From:
- Source:
debug :boolean
Get and set the debug flag.
Type:
- boolean
- Inherited From:
- Source:
frameRate :number
Get and set the default frame raet.
Type:
- number
(readonly) onDestroy :FORGE.EventDispatcher
Get the onDestroy FORGE.EventDispatcher, this event is emitted at the end of the destroy sequence.
Type:
- Inherited From:
- Source:
(readonly) tags :Array
Get the tags associated to this object.
Type:
- Array
- Inherited From:
- Source:
(readonly) uid :string
Get the uid of the object.
Type:
- string
- Inherited From:
- Source:
warning :boolean
Get and set the warning flag.
Type:
- boolean
- Inherited From:
- Source:
Methods
add(nameopt, startopt, endopt, frameRateopt, loopopt)
Add an animation sequence to this sprite.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string |
<optional> |
The name of your animation sequence. |
start |
number |
<optional> |
The starting frame index of the full frames array. |
end |
number |
<optional> |
The end frame index of the full frame array. |
frameRate |
number |
<optional> |
The frame rate of this animation (default: 60) |
loop |
boolean |
<optional> |
Does the animation have to loop? (default: false) |
addConfig(config)
Add a configuration for animations
Parameters:
Name | Type | Description |
---|---|---|
config |
Array.<SpriteAnimationConfig> | The configuration to add |
destroy()
Destroy method
- Overrides:
- Source:
get(name) → {FORGE.SpriteAnimation}
Get an animation by its name.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the animation you want to get. |
Returns:
Returns the asked animation if exists, null if not.
log(value)
Basic log method, log a string in the console if debug is enabled.
Parameters:
Name | Type | Description |
---|---|---|
value |
* | The value you want to log in the console. |
- Inherited From:
- Source:
pause(indexopt)
Pause the animation.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
index |
number |
<optional> |
The frame index on which to pause to animation. Default will be the current frame. |
play(animationopt, loopopt, indexopt)
Play the curretn animation or a specified animation.
If the Sprite is not loaded, kepp this method call in pending.
If the Sprite is not loaded, kepp this method call in pending.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
animation |
string |
<optional> |
The animation name you want to play. |
loop |
boolean |
<optional> |
Does the animation should loop? |
index |
number |
<optional> |
The index of the animation to play |
resume(indexopt)
Resume the animation.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
index |
number |
<optional> |
The frame index on which to pause to animation. Default will be the current frame. |
stop()
Stops the current animation, reset it to its first frame.
update()
Internal update method.
Main purpose is to update the current animation.
Main purpose is to update the current animation.
warn(valuenullable)
Basic warn method, log a warn string in the console if warning is enabled.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
value |
string | Object |
<nullable> |
The value you want to warn in the console. |
- Inherited From:
- Source: