Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resumeAnimation causes globe to spin very fast (catch up with missed autoRotation) #199

Closed
martenls opened this issue Apr 20, 2024 · 2 comments

Comments

@martenls
Copy link

Im using the autoRotate feature of the globe controls and implemented a mechanism where the animation is paused when the page is not visible to save resources.

watch(pageVisibility, (current) => {
  if (current == 'visible') {
    if (gameState.value == GameState.PresetSelection && selectedPreset.value == Preset.World) {
      globe.controls().autoRotate = true;
    }
    globe.resumeAnimation()
  } else {
    globe.controls().autoRotate = false;
    globe.pauseAnimation()
  }
})

However, this causes the globe to spin very fast for a short amount of time after resumeAnimation() is called. It seems it tries to catch up to the rotation it would have usually reached in the time the tab was inactive (if the page is not active for a longer time the fast spin takes longer).

Is there any way to prevent this behavior?

@vasturiano
Copy link
Owner

vasturiano commented Apr 21, 2024

@martenls thanks for your report.

I've just fixed this issue. It was in another package that is a direct dependency of this one: three-render-objects. So all you should need to do is update your dependency tree to include at least v1.29.4 of that package. Then you shouldn't experience this issue any more.

Please let me know if it fixes it for you.

@martenls
Copy link
Author

I updated the dependencies and the issue is gone.

Thanks for the quick answer and for your work on the project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants