Ping pong animation continuously

I am using a GLTF model animation.I have written a code to ping-pong the animation using onAnimationEnd event and reversing keyFrames and negating the speedRatio. It works fine once but doesn’t loop.i.e. onAnimationEnd is called only once when animation goes from 0 to 9, not when it goes again from 9 to 0.
What could possibly be wrong?
Also one question not related to this : animation.animatables[0].masterFrame works only once when the animation hasn’t completed. Can anyone please explain animatables masterFrame. I just want to know the current frame always.

Playground :

I am very new to Babylon. Any input would help. Thanks in advance.

Pinging @Drigax who may help here.

Can anybody help?

I think @Drigax is still in vacation today, he will have a look whenever possible.


This playground doesn’t work for me.

babylon.js:16 BJS - [16:21:52]: Unable to import meshes from Animation/Bee.glb: Error status: 404 - Unable to load Animation/Bee.glb
e._ErrorEnabled @ babylon.js:16

@bghgary Updated the playground :

This was harder than I expected, but here it is:

1 Like

That’s perfect…Thanks a lot @bghgary

1 Like