DEV Community

Ben Halpern
Ben Halpern Subscriber

Posted on

Explaining requestAnimationFrame in 256 characters or fewer

This is a submission for DEV Challenge v24.03.20, One Byte Explainer: Browser API or Feature.

(I'm a challenge judge so this is participation-only 😋)

Explainer

requestAnimationFrame is a method which instructs the browser to sync animations with the browser's repaint times.

It prevents glitches in animation-heavy scenarios, but adds complexity and extra overhead, so it should only be used when necessary.

Additional Context

If you're experiencing browser jank, this sometimes works like magic, and I'm surprised it isn't more well-known or widely used.

Top comments (0)