skeleton:addAnimation()¶
Type:
functionSee also: skeleton, skeleton:setAnimation()
Overview¶
Queues an animation to play after the current one completes on the specified track, optionally waiting a certain delay before starting.
If no animation is currently playing on the track, the queued animation will start immediately.
Syntax¶
local trackEntryOrFalse = skeleton:addAnimation(trackIndex, animationName, loop, delay)
Parameters¶
trackIndex(required):number– The 1-based track index to queue the animation.
animationName(required):string– Name of the animation.
loop(optional):boolean– Loop or not. Defaults tofalse.
delay(required):number– Additional delay in milliseconds before starting.
Return value¶
trackEntry or false– Returns a trackEntry on success, otherwisefalse.
Example¶
-- Start "walk" now, queue "run" afterward, delayed by 200ms
spineboy:setAnimation(1, "walk", true)
spineboy:addAnimation(1, "run", true, 200)
Notes¶
The returned trackEntry is intended for immediate setup (for example mixDuration).
Avoid holding references for long periods while the queue continues to change.