Cocos2d-x 3.17 can play frame animation assembled in code or authored in a Cocos Studio timeline. Code is convenient for a simple sprite-sheet sequence; Studio is useful when animation involves several UI nodes and properties.
Build animation from a sprite sheet
Load the plist, collect frames in order, and create an action:
1 | local cache = cc.SpriteFrameCache:getInstance() |
The interval is seconds per frame. Keep the plist and texture loaded for the lifetime of the animation, and remove them only after no live sprite or action uses their frames.
Play a Cocos Studio timeline
1 | local node = cc.CSLoader:createNode("animation/scene.csb") |
The named animation must exist in the exported CSB. Retain a reference to the node or timeline when later code needs to stop, switch, or inspect it.
Use atlases to reduce texture changes, but watch atlas size and memory. Choose an update interval that matches the artwork; duplicating frames to force a high timeline frame rate wastes data without creating smoother source animation.