Skip to content

AnimatedSprite ​

Creates a AnimatedSprite

A simple way to display an animation depicted by a list of textures.

I recommend using spritesheets created by TexturePacker (they have a great tutorial on it). If you don’t want to use spritesheets, you can simply just pass in an array of your desired textures.

Spritesheet ​

Multiple Animations from Spritesheet ​

API ​

AnimatedSprite Attributes ​

NameTypeDefaultDescription
blend-mode

number BLEND_MODES

'normal'The blend mode to be applied to the sprite.
anchor

number array object

0The anchor sets the origin point of the text.
anchor-xnumber0The x anchor sets the origin point of the text.
anchor-ynumber0The y anchor sets the origin point of the text.
texturesarrayundefinedThe textures to use for the animation
animation-speednumber1The speed that the AnimatedSprite will play at. Higher is faster, lower is slower
loopbooleantrueWhether or not the animate sprite repeats after playing.
playingbooleanfalseWhether or not the animation is playing.

more attributes in Container Attributes and AnimatedSprite

AnimatedSprite Events ​

NameTypeDescription
loopfunctionwhen the AnimatedSprite finishes playing.
frame-changefunctionwhen the AnimatedSprite changes to a new frame.
completefunctionwhen the AnimatedSprite finishes playing.
effectfunctioncustom rendering listener

more events in Container Events