interactionadvanced

Animation

Programmatic motion that communicates state changes, guides attention, or provides feedback.

Plain English

Good animation serves the user, not the designer. A loading spinner communicates "the system is working." A success checkmark provides feedback that the form submitted. A notification that slides in from the right attracts attention without interrupting. The cardinal rule: animation should be purposeful and brief. Animations that exist purely to look impressive slow users down and signal a design that prioritises style over function.

Technical

CSS animations use the animation property with @keyframes. Key values: animation-name, animation-duration, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, animation-fill-mode. For continuous animations (spinners): animation-iteration-count: infinite. For entrance animations: animation-fill-mode: both with a short delay prevents flash-of-content. Always provide @media (prefers-reduced-motion: reduce) overrides that either disable or drastically reduce animations.

Live Demo

Easing Comparison

ease-linear
ease-in
ease-out

ease-out feels most natural — fast start, gentle stop, like real-world physics.

Usage

✓ Good usage

A 200ms fade-in + slight upward translate on a modal entrance, with a matching 150ms fade-out on close — communicates depth and provides contextual feedback.

✗ Bad usage

Full-page dissolve animations between every screen change at 600ms — beautiful in a Dribbble shot, unusable in a real product where users click quickly.

Common mistakes

AI Prompt Example

Copy this into Claude, Cursor, Bolt, or v0.

Use animation only for: loading states (spinner), success/error feedback, modal entrance/exit, and notification slide-in. All animations under 300ms. Always include @media (prefers-reduced-motion: reduce) { * { animation-duration: 0.01ms !important; }}.