Nanfeng

Notes on software development, code, and curious ideas

Pausing, Resuming, and Restarting Spine Animation in Cocos Creator

pauseAllActions() on the node does not pause a Spine skeleton. Use the paused property:

1
2
3
4
const skeleton = this.spineNode.getComponent(sp.Skeleton);

function pause() { skeleton.paused = true; }
function resume() { skeleton.paused = false; }

This resumes from the paused position. To stop and replay from the beginning:

1
2
function stop() { skeleton.clearTrack(0); }
function restart() { skeleton.setAnimation(0, 'animation', false); }
+