Playing Animation in Reverse

I’m trying to play an animation in reverse, to avoid having two animations for a system that needs to play forwards and backwards at different times.

This code doesn’t seem to fire the animation at all - am I going about this in the right way?

    var animEntity = this.app.root.findByName( "HighRoller_TransitionIn" );
    var animID = animEntity.animation.assets[0];
    var animAsset = this.app.assets.get( animID );
    animEntity.animation.speed = -1;
    animEntity.animation.currentTime = animEntity.animation.duration;
    animEntity.animation.play( animAsset.name );
1 Like

bump - any takers for this? I never did find a workaround besides having another animation that runs backwards.

Do you have a project handy to fork off?

ack, not right now, as it’s one I can’t share, but I shall recreate in a fresh project and reply when I have. Thanks!

If you wish to play backwards, the currentTime cannot be set to the animation duration, or it will not start playing. The workaround I use in my projects is to set the currentTime a portion smaller than the animation duration:

animEntity.animation.currentTime = animEntity.animation.duration - 0.01;

This should help you.

1 Like

Have you solved it now?:open_mouth:

I have the same problem now.:cold_sweat:

===========================================

OK,I’ve already solved it!:grinning:

    anim.play("75_houmen.json");
    anim.speed = -1;
    anim.currentTime = anim.duration -  0.000000000001;
1 Like

I hadn’t solved it, nope - that seems as good as we’ll manage (the minute offset solution) - thanks, folks :slight_smile:

how

Hi @kuldeep and welcome,

Can you elaborate on your exact issue and what you are trying to achieve?