Skip to content

requestAnimationFrame

requestAnimationFrame tells the browser to execute a function before the next repaint. It’s the recommended way to create smooth animations.

  • Runs before the next repaint, synced with monitor refresh rate
  • Provides timestamp for frame-rate independent animation
  • Automatically pauses in background tabs
  • Preferred over setTimeout/setInterval for animations