Event Loop

Render step & rAF

After microtasks drain, the browser may paint. requestAnimationFrame (rAF) callbacks run right before that paint — the right place for visual updates so they land in the next frame.

rAF runs your animation step just before the browser repaints the screen.

Task
task
Microtask queue
rAF
Paint
Watch requestAnimationFrame (rAF) run before paint

One of 40 cards in the JavaScript deck. Browse every card.