skeleton:setAnimation()¶
Type:
functionSee also: skeleton
Overview¶
Immediately sets an animation on a given track, overwriting any existing animation on that track.
Syntax¶
local trackEntryOrFalse = skeleton:setAnimation(trackIndex, animationName, loop)
Parameters¶
trackIndex(required):number– 1-based track index.
animationName(required):string– The name of the animation to set.
loop(optional):boolean–trueto loop,falseotherwise. Defaults tofalse.
Return value¶
trackEntry or false– Returns a trackEntry on success, otherwisefalse.
Example¶
spineboy:setAnimation(1, "run", true)
Notes¶
The returned trackEntry is meant for immediate configuration and inspection. Do not keep
long-lived references to track entries across clears/replacements.