This repository was archived by the owner on Nov 12, 2024. It is now read-only.
Replies: 1 comment 1 reply
-
1. 'pingpong' not working when 'loop=false'To make 'pingpong' work even when 'loop' is set to false, you can update your animation definitions. Use the following modified 'attack' and 'skill' animations: 'anims': {
'idle': { from: 0, to: 5, speed: 12, loop: true },
'attack': { from: 6, to: 12, speed: 16, loop: false, pingpong: true },
'skill': { from: 13, to: 30, speed: 16, loop: false, pingpong: true },
'hit': { from: 31, to: 35, speed: 16, loop: false }
}2. Adding a callback for onFrameChange during the 'skill' animationTo add a callback for the 'onFrameChange' event during the 'skill' animation, you can modify your sprite.SKill function like this: sprite.SKill = (target) => {
sprite.play('skill', {
onFrameChange: (frame) => {
// Your callback logic here, based on the current frame
console.log(`Frame changed to: ${frame}`);
}
});
// I need to know when to keyframe
target.play('hit');
_.addKaboom(target.pos, { scale: 1.2, speed: 1 });
}Now, when the 'skill' animation is playing, the callback will be triggered on each frame change, allowing you to add your custom logic. Hope this helps!! |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
my code
1: 'pingpong' does not work when 'loop=false'
2: I need to know when to keyframe
Beta Was this translation helpful? Give feedback.
All reactions