Reversed animation

https://playground.babylonjs.com/#7V0Y1I#930
I have an animation, and I want to play a reversed animation. Is it possible?

Hi Kuangzheng_Xia :wave:

Does this post help?

1 Like

One of those
https://playground.babylonjs.com/#7V0Y1I#933
https://playground.babylonjs.com/#7V0Y1I#934
Cheers! :beers:

2 Likes

Thanks @MarianG , @PirateJC any place in the doc you could add those ?

I made a small modification to make it just a tiny bit easier to digest.

https://playground.babylonjs.com/#7V0Y1I#940

You can see the difference in playing an animation forward vs. backwards in lines 39 and 42. Simply comment one of them out to see a different result.

Essentially to answer the question, playing an animation in reverse is as simple as swapping the “from” and “to” values in the method:

scene.beginAnimation(box, endFrame, startFrame, false);

I’ll add this into the animation doc for future folks to learn from.

Hope this is helpful!

5 Likes

Updated the doc

Should be live here in a few mins:

2 Likes

Thank you all :bowing_man: