object:setSequence()

Type Function
Object SpriteObject
Library display.*
Return value none
Revision Release 2022.3683
Keywords sprite, setSequence
See also display.newSprite()

Overview

Loads an animation sequence by name.

Syntax

object:setSequence( [ sequenceName ] )
sequenceName (optional)

String. The name of the sequence you want to load (to be played). If not specified, the first frame in the currently loaded sequence will be shown instead.

Gotchas

After changing the sequence, the sprite will not play automatically — call object:play() to continue playing on the new sequence.

Example

spriteObj:setSequence( "running_man" )
spriteObj:play()