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

Continously rotating without jumps between tours #608

Open
korbav opened this issue May 4, 2021 · 4 comments
Open

Continously rotating without jumps between tours #608

korbav opened this issue May 4, 2021 · 4 comments

Comments

@korbav
Copy link

korbav commented May 4, 2021

I'm trying to achieve a very simple thing, rotating a square continuously without a jump between 2 tours.
I want to keep control of the position and therefore I don't want to use the loop property available in the different hooks.

I created a codesandbox to explain the current situation : https://codesandbox.io/s/twilight-http-l0jm0?file=/src/App.js

As you can see when it goes forward 360 degrees, it's animating all the way back to go to 0.
I suppose this is the expected behaviour. Thus, my question is, is there any way to smoothly animate between 2 rotation tours instead of animating all the way back?

Thanks in advance!

@InterstellarMario
Copy link

(this.state.currentRotationValueInDegrees + 10)
instead of
(this.state.currentRotationValueInDegrees + 10) % 360

@theformer
Copy link

theformer commented Sep 16, 2022 via email

@korbav
Copy link
Author

korbav commented Sep 16, 2022

(this.state.currentRotationValueInDegrees + 10) instead of (this.state.currentRotationValueInDegrees + 10) % 360

That works but that has the potential to lead soon or later to a Javascript exception caused by the MAX_SAFE_INTEGER limit reached.

@theformer
Copy link

theformer commented Oct 11, 2022 via email

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

3 participants