Class: SpriteAnimationClip

pc.SpriteAnimationClip

Handles playing of sprite animations and loading of relevant sprite assets.

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
Name Type Attributes Description
fps Number <optional>
Frames per second for the animation clip.
loop Object <optional>
Whether to loop the animation clip.
name String <optional>
The name of the new animation clip.
spriteAsset Number <optional>
The id of the sprite asset that this clip will play.
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.
Source:

Methods

(private) _update(dt)

Advances the animation looping if necessary
Parameters:
Name Type Description
dt Number The delta time
Source:

pause()

Pauses the animation.
Source:

play()

Plays the animation. If it's already playing then this does nothing.
Source:

resume()

Resumes the paused animation.
Source:

stop()

Stops the animation and resets the animation to the first frame.
Source:

Events

end

Fired when the clip stops playing because it reached its ending.
Source:

loop

Fired when the clip reached the end of its current loop.
Source:

pause

Fired when the clip is paused.
Source:

play

Fired when the clip starts playing
Source:

resume

Fired when the clip is resumed.
Source:

stop

Fired when the clip is stopped.
Source: