Control Animation Percentage

Hi all,

I am trying to play an animation with a slider (that goes from -10 to 10). What Im trying to achieve is that if the slider is at 0, the animation will stay still at frame0. If I slide to 10, I want it to animate forward and stop at the final frame. If I slide it to -10, I want it to animate backwards and stop at the final frame.

Basically Im trying to recreate the animation percentage slider that can be seen if you click on an animation sequence.

Hopefully this makes some sense, and thanks for your help :slight_smile:

Different ways to do this / different uses.
The easiest is with state machines.

Say you are in a state machine, you have options to “Exit” said state.
One of the viable options is to connect a “time remaining ratio” node to a <= and use the Boolean result as the transition.

In your case, the second option in <= will be a custom variable that you will instantiate and set from the slider/widget/ui/whatever. This will cause the animation to “exit” after playing for X amount of time. or Play for X amount of time and then exit.
You have several nodes to choose from. Time elapsed, remaining. in ratio, or in time. up to you what you end up using.

I believe the only caveat to access those nodes is that the animation should not be set to loop. That may only be true for Ratios since you can’t have a ratio on an infinite loop…