The Web Animations API vs. CSS
Blog post from LogRocket
Web animations are increasingly popular in web design, with developers having the option to create them from scratch using CSS transitions, CSS animations, or the JavaScript Web Animations API (WAAPI), despite the availability of JavaScript animation libraries like Framer Motion and GreenSock. This tutorial delves into these three methods, offering demos to illustrate how they work and highlighting the Web Animations API's benefits, such as greater control over animations through features like keyframes and the ability to specify easing functions for individual keyframes. CSS transitions allow for smooth changes between states, while CSS animations utilize @keyframes to define animation sequences. In contrast, the Web Animations API provides more nuanced control, allowing developers to animate elements with specific timing functions and composite properties, which are not possible in CSS. The tutorial concludes by suggesting that simpler animations are best implemented in CSS, while more complex animations benefit from the flexibility of JavaScript, and mentions third-party tools like Flow for exporting animations.