rendering opportunity
A point in the event loop, between tasks, when the browser may run animation callbacks, recalculate style and layout, and paint a new frame.
In more detail
It only comes when the current task and all microtasks are done, and usually at most once per display refresh. Long tasks push it back and cause dropped frames.
Related terms
- event loop — The central loop of an asynchronous program that waits for events, such as timers firing or data arriving, and runs the matching callbacks.
- macrotask — An ordinary task scheduled on the event loop, such as a timer or I/O callback, as opposed to a microtask.
- requestAnimationFrame() — A function that schedules a callback to run just before the browser's next repaint, the right place to update animations.
Taught in
- The Browser Event Loop: Call Stack, Microtasks And Macrotasks — Frontend Architecture & Web Platform
- requestAnimationFrame vs requestIdleCallback: High-FPS Work — Frontend Architecture & Web Platform