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

Fix sluggish performance in Safari by using timestamp from requestAnimationFrame to determine fade progress #331

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

islandsvinur
Copy link

Hi Andre,

This fixes the sluggish performance in Safari. By using the timestamp that requestAnimationFrame provides to the callback, we can calculate the progress of the animation. Also tested in Edge, Chrome and Firefox on macOS, which all still behave properly.

I put the rebuild in a separate commit; didn't know if you want to rebuild it yourself for a release.

Fixes #315

@islandsvinur
Copy link
Author

islandsvinur commented Mar 4, 2024

I just realised, for starting/target opacities < 1 the animation time will be shorter than fadeSpeed. With a fadeSpeed: 300 and a target or starting opacity of 0.5, the animation will now take 150 ms. Because the setting is called fade speed, it suggests a certain step size instead of the duration of the animation.

I will fix the code to keep the current behavior.

@Mtillmann
Copy link
Collaborator

@islandsvinur thanks for your dedication! Great work 🙏

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

Successfully merging this pull request may close these issues.

sluggish performance in Safari
2 participants