bug: animate() doesn't work if called with a delay after the animate component is created #556
-
Describe the bugAnimations (specifically with But if animations are applied later (either with The problem appears to be the initial timestamp being set when the kaplay/src/components/misc/animate.ts Lines 509 to 511 in b89b97c This would probably work ok if VersionReplicated in both 3001.0.2 and 4000.0.0-alpha15 To Reproducekaplay({
width: 500,
height: 500,
});
const red = add([
circle(30),
color(RED),
pos(150, 250),
scale(),
animate()
]);
const blue = add([
circle(30),
color(BLUE),
pos(350, 250),
scale(),
animate()
]);
// Works ok because the game object was only just created
red.animate("scale", [vec2(1), vec2(2)], { duration: 0.5, loops: 1 })
// Just jumps to the final frame
wait(1, () => {
blue.animate("scale", [vec2(1), vec2(2)], { duration: 0.5, loops: 1 })
}) Expected behaviorIf a game object has the |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
There's a seek method for that reason, to seek to time 0. |
Beta Was this translation helpful? Give feedback.
-
Ah I see. I don't think that's mentioned in the docs. I guess it just comes down to unintuitive behaviour for someone new to the library. It makes sense to have a seek function for advanced manipulation of an animation. But I just expected the animate function to... animate. Since my first use of it was on a button press, it wasn't at all obvious why I was getting that behaviour. Should any call to animate() just automatically seek to time 0? |
Beta Was this translation helpful? Give feedback.
-
I'll rather leave the control to the user. Animate is originally made to define an animation, then play it. |
Beta Was this translation helpful? Give feedback.
There's a seek method for that reason, to seek to time 0.