Constructor
new SpriteAnimationClip(component, data)
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
component |
pc.SpriteComponent | The sprite component managing this clip. | ||||||||||||||||||||
data |
Object | Data for the new animation clip.
Properties
|
Properties:
Name | Type | Description |
---|---|---|
spriteAsset |
Number | The id of the sprite asset used to play the animation. |
sprite |
pc.Sprite | The current sprite used to play the animation. |
frame |
Number | The index of the frame of the pc.Sprite currently being rendered. |
time |
Number | The current time of the animation in seconds. |
duration |
Number | The total duration of the animation in seconds. |
isPlaying |
Boolean | Whether the animation is currently playing. |
isPaused |
Boolean | Whether the animation is currently paused. |
Methods
(private) _update(dt)
Advances the animation looping if necessary
Parameters:
Name | Type | Description |
---|---|---|
dt |
Number | The delta time |
pause()
Pauses the animation.
play()
Plays the animation. If it's already playing then this does nothing.
resume()
Resumes the paused animation.
stop()
Stops the animation and resets the animation to the first frame.
Events
end
Fired when the clip stops playing because it reached its ending.
loop
Fired when the clip reached the end of its current loop.
pause
Fired when the clip is paused.
play
Fired when the clip starts playing
resume
Fired when the clip is resumed.
stop
Fired when the clip is stopped.