https://playground.babylonjs.com/#7V0Y1I#930
I have an animation, and I want to play a reversed animation. Is it possible?
Hi Kuangzheng_Xia
Does this post help?
One of those
https://playground.babylonjs.com/#7V0Y1I#933
https://playground.babylonjs.com/#7V0Y1I#934
Cheers!
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!
Updated the doc
Should be live here in a few mins:
Thank you all