-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
add limit to getDuration()
in spring
function to avoid infinite loops
#767
Conversation
Shouldn't this be named |
Also maybe it would be an idea to use |
I think there are times people would want an infinite loop though... (Like if you had a terminal blinking, it could blink the underscore infinitely...) Screen.recording.2022-01-17.12.20.52.PM.mp4 |
While calculating the spring easing, the for loop can sometimes encounter infinite loops that cause the browser to freeze, I've run into this problem a couple times. I choose 10,000 because it was the value that allowed for the most accurate spring easings while avoiding the browser freezing for extended periods of time. |
That is true, but I hope there is an alternative method added, to allow things like my example, to work. |
What you're looking for is different from what this pr is aiming to fix, but yeah I agree with you, it would be cool if animejs supported blinking animation |
Yeah, just making sure it doesn't break what I am using it for lol. |
Could you post the code which freezes the browser please? Maybe there's another solution to the problem. |
The way the
getDuration()
method in thespring()
function is setup it doesn't have any way of stopping an infinite loop. I added aINTINITE_LOOP_LIMIT
of 10,000 to stop possible infinite loop situations.