Skip to content

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

Open
islandsvinur wants to merge 4 commits into
andreknieriem:masterfrom
islandsvinur:master
Open

Fix sluggish performance in Safari by using timestamp from requestAnimationFrame to determine fade progress#331
islandsvinur wants to merge 4 commits into
andreknieriem:masterfrom
islandsvinur:master

Conversation

@islandsvinur

Copy link
Copy Markdown

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

islandsvinur commented Mar 4, 2024

Copy link
Copy Markdown
Author

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
Copy Markdown
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