Most UI animation isn't a library — it's three CSS primitives wrapped in Tailwind utilities. Knowing the primitives means you reach for Framer Motion only when you actually need it.
The three primitives
- Transitions — interpolate between two states (e.g.
hover:bg-brand-strong transition-colors). Cheap, GPU-friendly, the default for state-driven UI. - Keyframes — predefined animation sequences (
@keyframes) you reference with theanimationproperty. For pulses, spinners, anything that loops or has multiple stops. - Web Animations API — JavaScript-driven, used for orchestration that can't be expressed in CSS (sequencing, dynamic durations). Frame-perfect, but rarely needed.
Tailwind's built-in utilities
Tailwind v4 ships transition, duration-200, ease-in-out, plus built-in keyframe animations: animate-spin, animate-pulse, animate-bounce, animate-ping. Combined with your own @keyframes + utility class (lesson 3), this covers 90% of needs.
When to reach for Framer Motion
Complex interaction: drag-and-drop, layout animations (FLIP), shared element transitions between routes, gesture handling. If you're sequencing multiple elements with different easings and timings, Framer Motion's animate + variants API saves you. For everything else — transitions and keyframes.
Respect prefers-reduced-motion
Some users (vestibular disorders, motion sensitivity) prefer minimal animation. Wrap motion-heavy effects in a media query that disables them when the user has set the preference.
transform: translate over top/left; opacity over display.