WebKit / explainers

Explainers from WebKit contributors
371 stars 28 forks source link

Relation to update-the-rendering #87

Open chrishtr opened 2 years ago

chrishtr commented 2 years ago

(related to #85)

Re: https://github.com/WebKit/explainers/tree/main/animation-frame-rate

If there is an animation declared to be at a different frame rate than the update-the-rendering steps, then how does the processing model for updates work?

smfr commented 2 years ago

These are good questions, and I think the explainer should explain them!

graouts commented 2 years ago

@chrishtr when you say:

How should the developer indicate that they'd like animations to be synced if possible?

What is the thing you'd like the animations to be synced with? Issue #84 has a fair bit of discussion about how animations are synced with each other, but since you mention others steps from the "update the rendering" procedure, I wanted to be sure this was what you meant.

chrishtr commented 2 years ago

What is the thing you'd like the animations to be synced with? Issue #84 has a fair bit of discussion about how animations are synced with each other, but since you mention others steps from the "update the rendering" procedure, I wanted to be sure this was what you meant.

You might want scrolling and an animation to have the same frame rate, for example. This particular example is also related to the update-the-rendering steps, because scroll events happen during update-the-rendering.

I am skeptical that it's a good idea to have main thread animation or scroll updates that require style / layout, but that don't invoke some of the update-the-rendering steps, because all of the related specs and APIs depend on this processing model, and implementations are architected around it.

And if the animation does run those steps, that means requestAnimationFrame fires at that rate. So it's unclear to me how to make a main-thread animation that doesn't run at the same frame rate as requestAnimationFrame, or that implies the latter runs faster than 60fps.

I do think there is room to consider running some animations slower than 60fps, but if it isn't an integer multiple of the update-the-rendering steps, then it'll cause even more update-the renderings.