Event Loop

Render Step & rAF

After microtasks drain, the browser may paint. requestAnimationFrame 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
Microtasks
rAF
Paint
rAF runs just before the paint

Tap the example to replay it · press and hold to slow it down

One of 40 cards in javascript flashcards. Browse every card.