new SpriteAnimation(sprite, name, frames, frameRateopt, loopopt)
Animation for Sprites.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
sprite |
FORGE.Sprite | The Sprite that is animated. | ||
name |
string | Name of the animation. | ||
frames |
Array | The frames taht compose this animation. | ||
frameRate |
number |
<optional> |
30 | Frame rate of this animation (default: 30) |
loop |
boolean |
<optional> |
true | The loop flag |
- Source:
- To Do:
-
- Work on trimmed textures
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:
(readonly) complete :boolean
Get the complete status of the SpriteAnimation.
Type:
- boolean
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:
(readonly) frameIndex :number
Get the current frame index of the SpriteAnimation.
Type:
- number
(readonly) frameRate :string
Get the frame rate of the SpriteAnimation.
Type:
- string
(readonly) frames :Array.<Object>
Get the frames array of the SpriteAnimation.
Type:
- Array.<Object>
loop :boolean
Get and set the loop flag of the SpriteAnimation.
Type:
- boolean
(readonly) loopCount :boolean
Get the loop count of the SpriteAnimation.
Type:
- boolean
(readonly) name :string
Get the name of the SpriteAnimation.
Type:
- string
(readonly) onDestroy :FORGE.EventDispatcher
Get the onDestroy FORGE.EventDispatcher, this event is emitted at the end of the destroy sequence.
Type:
- Inherited From:
- Source:
paused :boolean
Get the paused status of the SpriteAnimation.
Type:
- boolean
(readonly) playing :boolean
Get the playing status of the SpriteAnimation.
Type:
- boolean
(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
destroy()
Destroy method
- Overrides:
- Source:
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 the animation. Default will be the current frame. |
play(loopopt, indexopt)
Play this animation.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
loop |
boolean |
<optional> |
Does the animation have to loop on complete? |
index |
number |
<optional> |
the index to play at |
resume(indexopt)
Resume the animation
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
index |
number |
<optional> |
The frame index on which to resume the animation. Default will be the current frame. |
stop()
Stops the animation, reset it to the first frame.
update()
Update loop that will be called by the DisplayList through Sprite & SpriteAnimationManager update
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: