Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goooooouwa/a240a57208306c5ccc2fa47f09054923 to your computer and use it in GitHub Desktop.
Save goooooouwa/a240a57208306c5ccc2fa47f09054923 to your computer and use it in GitHub Desktop.
var anim = this.node.getChildByName("flashLight").getComponent(cc.Animation);
// these 3 steps must in order to play and pause the animation at 0.5s
anim.setCurrentTime(0.5, 'flashLight');
anim.play("flashLight");
anim.pause('flashLight');
this.render().then(() => {
// these 2 steps must in order to resume the animation from 0.5s
anim.setCurrentTime(0.5, 'flashLight');
anim.resume("flashLight");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment