The Web Animations API gives JavaScript control over CSS animations with composition, playback, and timeline syncing. element.animate(keyframes, options) returns an Animation object you can pause, reverse, or chain.
It composites on a separate thread, so motion stays smooth even when the main thread is busy. Pair it with the upcoming Scroll-Driven Animations API to tie animation progress to scroll position.
For complex sequences, Animation.finished is a promise that resolves when the animation completes — cleaner than tracking animationend events.