explainers icon indicating copy to clipboard operation
explainers copied to clipboard

Relation to update-the-rendering

Open chrishtr opened this issue 3 years ago • 3 comments

(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?

  • Is the proposal to do some updates that skip some of these steps, and "only" update the animation? i.e. are you proposing that requestAnimationFrame, ResizeObserver, resize event, IntersectionObserver, etc steps don't run in such updates? Or only if it happens to coincide with the update-the-rendering timing?

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

  • If the regular update-the-rendering steps are not customizable, that could lose an opportunity for lowering the frame rate for devices that are low on battery.

chrishtr avatar Dec 16 '21 22:12 chrishtr

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

smfr avatar Dec 17 '21 01:12 smfr

@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.

graouts avatar Dec 17 '21 07:12 graouts

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.

chrishtr avatar Dec 17 '21 17:12 chrishtr