Josh W Comeau
Read post

CSS vs. JavaScript • Josh W. Comeau

CSS keyframe animations and transitions run on a separate thread from JavaScript, making them immune to main thread blocking — unlike raw requestAnimationFrame loops or most JS animation libraries. Motion (formerly Framer Motion) is an exception because it uses the Web Animations API (WAAPI) under the hood, giving it the same off-main-thread benefits as CSS. GSAP runs on the main thread but offers more powerful features as a trade-off. The recommendation is to prefer native CSS animations, fall back to Motion when CSS falls short, and note that modern CSS APIs like View Transitions, linear(), and Animation Timeline reduce the need for JS libraries.

    #javascript#css
May 26•5m read time•From joshwcomeau.com
Post cover image
Table of contents
Table of ContentsLink to this heading Comparing CSS keyframes to JavaScript loopsLink to this heading Comparing animation librariesLink to this heading The right tool for the job
217.4K Impressions6 Comments
Josh W Comeau's image
Josh W Comeau

Josh W. Comeau's platform provides resources in frontend development, React.js, and CSS, offering in...

529 Followers

•

2.5K Upvotes

Would you recommend this post?

Copy link
WhatsApp
Facebook
X
New Squad
  • © 2026 Daily Dev Ltd.
  • Guidelines
  • Explore
  • Tags
  • Sources
  • Squads
  • Leaderboard