question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inconsistent behavior between AnimationMixer.stopAllActions() and AnimationAction.stop()

See original GitHub issue

Hi,

While trying to get my animations to work as I wanted, I noticed some inconsistent behavior between AnimationMixer.stopAllActions() and AnimationAction.stop().

What I was doing basically comes down to the following (assuming two AnimationActions A and B):

  1. Make my model visible.
  2. Fade in A
  3. After some time, cross-fade to B
  4. After some more time “stop all animations” and hide the model.
  5. At some later point in time, start again at 1. This is where the difference comes into play

Initially I just called stopAllActions() for “stop all animations” (Version 1 in the JSFiddle). But then I had the problem at step 5, that the fading in A again, started the fade in from the last pose that the model was in at step 4. So after stopAllActions() the model somehow seems to retained its last pose.

But if I instead call stop() on all AnimationActions (instead of just calling stopAllActions()), then the models starts fading in from the default pose (Versions 2/3 in the JSFiddle). (Which in my situation was what I wanted). After some investigation I found out that if stopAllActions() doesn’t cause restoreOriginalState() to be called on the bindings. While it does when using stop().

I’m not sure what the exact expected behavior should be, but I would guess the stop() behavior.

Change between VERSION 1, 2 & 3 in this JSFiddle to see the difference in behavior.


Note: If you would call stopAllActions() the first time and then for later “loops” use the stop() approach, then it will keep behaving as if stopAllActions() was called. I.e. it seems that the “original state” was updated to the last pose, and no longer is the default pose. But I didn’t investigate this any further though.


Three.js version
  • Dev
  • r116
Browser
  • All of them (Probably, only tested Chrome and Firefox)
  • Chrome
  • Firefox
  • Internet Explorer
OS
  • All of them (Probably, only tested Windows and Android)
  • Windows
  • macOS
  • Linux
  • Android
  • iOS

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
DsRQuickecommented, May 14, 2020

I’ll see what I can do for the unit test. I’ll have to figure out how to do them (properly (for animations)). So it might take a couple of days. Anyway, thank you for accepting the pull request for the issue.

2reactions
DsRQuickecommented, May 13, 2020

@Mugen87 I’m sorry, but I do think the reverse loop is needed. See this JSFiddle

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can an AnimationAction stop at the last frame without ...
This is my approach that I used with an enemy bot gltf model on my three.js prototype first person shooter. The robot has...
Read more >
AnimationMixer – three.js docs
Deallocates all memory resources for a clip. Before using this method make sure to call AnimationAction.stop() for all related actions.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found