Animation group frame update with reversed start and end frames

Example with Start/End frames reverse :

Example with speedRatio reverse :

Hi, i’m trying to generate a symmetric animation.
When the animation is over, i want to play it in reversed direction, repeat the reversing…

I have the possibility to set the current frame before playing the animation.
But after reversing my from and to frames of my animation group, playing the animation and moving to the specified frame, the animationGroup will not end at his ending frame.

I also tried with a negative speedRatio but i have the same problem.

I’m using animationGroups in my case.

I’m not sure if it’s a bug or not.

Thanks in advance :slight_smile:

You can use yoyo mode for that

Animation Examples | Babylon.js Playground

(also make sure to call play(true) to enable looping

I tried your solution but i have problems with it because i have an onAnimationGroupEndObservable and with a loop, it doesn’t trigger anymore.
Moreover with the yoyo loopMode, there is a kind of slow-down at the end of the animation before reaching ending frame. But there is no slow-down before reaching start frame when the animation is reversed.

I made a similar case to what i’m doing

I’m not sure to see the slow down:
Animation Examples | Babylon.js Playground

Ok well so you have your solution? Sorry I’m lost :smiley: What’s missing in your PG?

Indeed, in my example i didn’t put the suspected bug, sorry for that.
Here is the same example but just after playing the animation, i’m manually moving to a specific frame:

You can see that when the animation is reversed (from = 20 and to = 0) the animation does not revert at his end.
It do a complete loop before reversing, and that’s not the case when from = 0 and to = 20.
i set the ending frame to 20 to see more easily the problem.

hope this is better :slight_smile:

It was a bug!

Fix animation goToFrame with negative speedRatio by deltakosh · Pull Request #16589 · BabylonJS/Babylon.js

2 Likes

Thanks for the bugfix ! :smiley: