CSS animations

8 examples. Interface animations built with plain HTML and CSS: transitions, keyframes, scroll-driven animations and the View Transitions API. Each clip comes with a prompt your AI agent can follow to rebuild it.

CSS animations: common questions

Can you build smooth UI animations with CSS only?
Yes. Transitions and @keyframes on transform and opacity run on the compositor, scroll-driven animations (animation-timeline) handle scroll effects, and the View Transitions API animates between states without JavaScript libraries.
How do I approximate springs in CSS?
Use the linear() easing function with a sampled spring curve, or cubic-bezier with a slight overshoot such as cubic-bezier(0.34, 1.56, 0.64, 1) for small bounces.
How do I respect reduced motion in CSS?
Wrap movement in @media (prefers-reduced-motion: no-preference), or override it inside prefers-reduced-motion: reduce with fades or instant changes.

HTML/CSS by category

Other frameworks