Start a new topic

Reseting Animation

Hi there.


I might be just missing something obvious, but I can't seem to find a way to reset a models animation back to its original state once its finished playing. Is there a simple way of doing this?


Hello Simon,

I understand now your use case but unfortunately, bringing the animation to its original state, without starting it again, is not something that we support right now. However, as I totally understand the value of having such a functionality i have already added this to our feature list. As a temporary workaround what you could also test is calling the methods stop(), start() and then again stop(). However, this will not guarantee that the final state is exactly the start of the animation since during the start() and stop() there may be a short animation period.

Thanks
Eva

 

Hi Eva. 


Thanks for that. I think it would be a very useful.


I have already played around with the stop/start/stop work around, but I've found that calling the methods immediately after each other, the last stop call doesn't get picked up and the animation plays regardless. 


For anyone else that might be having this trouble the only way I've found to get this to work is to put the animation stop call in a separate method and then call it with a timeout of 100. ie:


 resetAnimation: function resetAnimationFn()

    {

        World.activeModel.Animation.start();

        window.setTimeout(World.stopAnimation,100);

    },

 

    stopAnimation: function stopAnimationFn()

    {

        World.activeModel.Animation.stop();

    }, 


Thanks


Simon.

Hello Simon,

Thank you for posting your solution here so that other users can see it as well.

Eva

 

Hello Simon,

What you need to do is call the stop() method followed by a start() method. That will restart the animation. In order to have a full reference of how these methods work you can refer to the Animation class of the Javascript interface here.

Thanks
Eva

Thanks Eva.


Not quite what I was after. I don't want the animation to play again, just put it back to its unplayed state.


Say I have an animation of a car door opening that starts with the door closed and finishes with it fully open. What I want to be able to do is set the animation so it is stopped at its door closed state - ie the beginning of the animation - without it playing again.


Thanks

Simon.

Hi Simon,

In this case, all you need to do is call the stop() method.

Thanks
Eva

 

Hi Eva. stop() just effectively pauses the animation at the frame it got to. I'm looking for a way to put it back to frame zero without the animation playing again, putting the model back to the state it was before any animation played.


Thanks

Simon.

Login or Signup to post a comment