requestAnimationFrame Loop Playground

A real rAF loop: painted frames vs your loop’s updates, delta-time, pauses and cleanup. rAF or setInterval: which suits animation, and why? An interactive…

Why it matters

rAF and delta-time are the base of smooth animation: games, canvas, scroll effects, physics. Knowing "one update per frame, movement per second" gives animation that runs at the same speed on every screen, saves battery and does not stutter, unlike setInterval.

The key idea

rAF follows the screen’s frames, delta-time makes speed follow time

Common mistakes

Try it in this playground