API Reference

Class List

pc.SpriteAnimationClip

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

Summary

Properties

durationThe total duration of the animation in seconds.
frameThe index of the frame of the pc.Sprite currently being rendered.
isPausedWhether the animation is currently paused.
isPlayingWhether the animation is currently playing.
spriteThe current sprite used to play the animation.
spriteAssetThe id of the sprite asset used to play the animation.
timeThe current time of the animation in seconds.

Methods

pausePauses the animation.
playPlays the animation.
resumeResumes the paused animation.
stopStops the animation and resets the animation to the first frame.

Events

endFired when the clip stops playing because it reached its ending.
loopFired when the clip reached the end of its current loop.
pauseFired when the clip is paused.
playFired when the clip starts playing
resumeFired when the clip is resumed.
stopFired when the clip is stopped.

Details

Constructor

SpriteAnimationClip(component, data)

Parameters

componentpc.SpriteComponentThe sprite component managing this clip.
dataObjectData for the new animation clip.
data.fpsNumberFrames per second for the animation clip.
data.loopObjectWhether to loop the animation clip.
data.nameStringThe name of the new animation clip.
data.spriteAssetNumberThe id of the sprite asset that this clip will play.

Properties

Numberduration

The total duration of the animation in seconds.

Numberframe

The index of the frame of the pc.Sprite currently being rendered.

BooleanisPaused

Whether the animation is currently paused.

BooleanisPlaying

Whether the animation is currently playing.

pc.Spritesprite

The current sprite used to play the animation.

NumberspriteAsset

The id of the sprite asset used to play the animation.

Numbertime

The current time of the animation in seconds.

Methods

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.