-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
spring
performs differently on displays with different refresh rates
#10717
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
Comments
spring
performs differently on displays with different refresh rates
Probably has a lot to do with requestAnimationFrame. MDN says "The frequency of calls to the callback function will generally match the display refresh rate." So on the 120Hz display, the spring's |
There's currently a large PR outstanding to refactor rendering and transitions: #10594. It's very likely that a bugfix for the spring code will have to wait untli that PR is finished. |
Thanks for taking a look.
svelte/packages/svelte/src/motion/spring.js Line 109 in 3fd02f1
|
This is interesting indeed. With the There's the hardcoded 60hz (t) argument to process easings in any given transition. And there's unfortunately no way of overriding that and make usage of Just today I've spent a huge amount of time trying to find clever ways to manage a wide range of animations in a project. From basic to advanced sequences. Came up with this interesting bug by the way: Back to the point of native CSS If I recall correctly, there has been an attempt in reworking the transition system. It would be neat to come up with clever ways to build a new Transition system that could simply handle WAAPI + javascript tick sync if needed + callbacks to handle, for instance, to await for any custom function to finish before unmounting the {# if} block - by default, tied to the finish() callback from a WAAPI, but could potentially be used by external libraries in any other way and so much more. There's even ViewTransition API which looks cool for some element transitions, particularly those from the FLIP technique. See here and here. By the way, love Svelte so much 💛 |
This might sound like a small annoyance but it unfortunately makes |
Describe the bug
After creating an element with
spring
stores used for coordinates, testing the animation on different displays results in a noticeably different animation.My animation on an m1 pro MacBook pro 120hz display:
https://github.com/sveltejs/svelte/assets/66829812/6eb6c1ba-8beb-46da-9fcb-81a950e02e54
The same animation on a 60hz external display:
https://github.com/sveltejs/svelte/assets/66829812/3f98b357-36b5-4aab-a6fe-04600c09d028
The same animation on the 60hz display resolves much slower.
Reproduction
I found this REPL online, where the same behavior can be observed when testing on both a 60hz and a 160hz display
https://svelte.dev/repl/spring?version=4.2.12
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: