-
Notifications
You must be signed in to change notification settings - Fork 602
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
Flickity animations take forever if your browser is configured to throttle frame rate (and hence requestAnimationFrame callbacks) #1305
Comments
Note that even for users who don't have any particular special configuration, The MDN article on this feature makes several mentions of this:
|
Here's a screencast showing this bug in action: (The bug is in the latter half of the screencast, after I toggle Firefox's |
Grounding this in the code a bit: the main animation loop seems to be here: proto.animate = function() {
this.applyDragForce();
this.applySelectedAttraction();
let previousX = this.x;
this.integratePhysics();
this.positionSlider();
this.settle( previousX );
// animate next frame
if ( this.isAnimating ) requestAnimationFrame( () => this.animate() );
}; Lines 27 to 38 in a64cc33
This function and its helpers (e.g. |
For me, in Firefox 126, with layout.frame_rate set to 1, I'm seeing full-speed animation when I click the previous chevron. It takes less than a second to go from rectangle 3 to rectangle 2. Codepen.Screen.Recording.2024-05-16.at.12.44.44.AM.mov |
Closing the loop on this: as discussed in https://bugzilla.mozilla.org/show_bug.cgi?id=1894842#c11 and following comments, it seems @ChasBelov's issue was due to another about:config setting (possibly Given that, let's set @ChasBelov's comment aside & keep this github issue focused on the thing discussed in my initial comment which is the fact that Flickity animations take forever if the actual animation-frame-frame rate is low (via e.g. user preferences like |
Test case: https://codepen.io/dholbert/pen/XWwbrRK
(This is just the default testcase, which I forked & didn't modify at all)
Steps to Reproduce:
about:config
and set preferencelayout.frame_rate
to2
(to limit the browser repaint cycle to 2-per-second).Actual Results:
The animation still plays every single frame of animation, but in extremely slow motion. So it takes ~20 seconds to complete the animation.
Expected Results:
Animation should still take the same amount of time (1 second or so), and each frame should simply make a huge amount of progress.
Notes:
layout.frame_rate
) is something that Firefox users do actually use for accessibility purposes, to reduce motion sickness from smooth animation. (See also Supportprefers-reduced-motion
media query #951 for a related-but-distinct flickity issue that's affecting this same group of users.)MOZ_ENABLE_WAYLAND=0
environmental variable in order for thelayout.frame_rate
config option to have an effect.The text was updated successfully, but these errors were encountered: