Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
One-time setup that gathers your project's design context and saves it to CLAUDE.md for future sessions.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
reference/motion-design.md
1# Motion Design23## Duration: The 100/300/500 Rule45Timing matters more than easing. These durations feel right for most UI:67| Duration | Use Case | Examples |8|----------|----------|----------|9| **100-150ms** | Instant feedback | Button press, toggle, color change |10| **200-300ms** | State changes | Menu open, tooltip, hover states |11| **300-500ms** | Layout changes | Accordion, modal, drawer |12| **500-800ms** | Entrance animations | Page load, hero reveals |1314**Exit animations are faster than entrances.** Use ~75% of enter duration.1516## Easing: Pick the Right Curve1718**Don't use `ease`.** It's a compromise that's rarely optimal. Instead:1920| Curve | Use For | CSS |21|-------|---------|-----|22| **ease-out** | Elements entering | `cubic-bezier(0.16, 1, 0.3, 1)` |23| **ease-in** | Elements leaving | `cubic-bezier(0.7, 0, 0.84, 0)` |24| **ease-in-out** | State toggles (there → back) | `cubic-bezier(0.65, 0, 0.35, 1)` |2526**For micro-interactions, use exponential curves.** They feel natural because they mimic real physics (friction, deceleration):2728```css29/* Quart out - smooth, refined (recommended default) */30--ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);3132/* Quint out - slightly more dramatic */33--ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);3435/* Expo out - snappy, confident */36--ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);37```3839**Avoid bounce and elastic curves.** They were trendy in 2015 but now feel tacky and amateurish. Real objects don't bounce when they stop; they decelerate smoothly. Overshoot effects draw attention to the animation itself rather than the content.4041## Premium Motion Materials4243Transform and opacity are reliable defaults, not the whole palette. Premium interfaces often need atmospheric properties: blur reveals, backdrop-filter panels, saturation or brightness shifts, shadow bloom, SVG filters, masks, clip paths, gradient-position movement, and variable font or shader-driven effects.4445Use the right material for the effect:4647- **Transform / opacity**: movement, press feedback, simple reveals, list choreography.48- **Blur / filter / backdrop-filter**: focus pulls, depth, glass or lens effects, softened entrances, atmospheric transitions.49- **Clip path / masks**: wipes, reveals, editorial cropping, product-like transitions.50- **Shadow / glow / color filters**: energy, affordance, focus, warmth, active state.51- **Grid-template rows or FLIP-style transforms**: expanding and reflowing layout without animating `height` directly.5253The hard rule is not "transform and opacity only." The hard rule is: avoid animating layout-driving properties casually (`width`, `height`, `top`, `left`, margins), keep expensive effects bounded to small or isolated areas, and verify in-browser that the result is smooth on the target viewports. If blur/filter makes the interaction feel significantly more premium and remains smooth, use it.5455## Staggered Animations5657Use CSS custom properties for cleaner stagger: `animation-delay: calc(var(--i, 0) * 50ms)` with `style="--i: 0"` on each item. **Cap total stagger time**: 10 items at 50ms = 500ms total. For many items, reduce per-item delay or cap staggered count.5859## Reduced Motion6061This is not optional. Vestibular disorders affect ~35% of adults over 40.6263```css64/* Define animations normally */65.card {66animation: slide-up 500ms ease-out;67}6869/* Provide alternative for reduced motion */70@media (prefers-reduced-motion: reduce) {71.card {72animation: fade-in 200ms ease-out; /* Crossfade instead of motion */73}74}7576/* Or disable entirely */77@media (prefers-reduced-motion: reduce) {78*, *::before, *::after {79animation-duration: 0.01ms !important;80transition-duration: 0.01ms !important;81}82}83```8485**What to preserve**: Functional animations like progress bars, loading spinners (slowed down), and focus indicators should still work, just without spatial movement.8687## Perceived Performance8889**Nobody cares how fast your site is, just how fast it feels.** Perception can be as effective as actual performance.9091**The 80ms threshold**: Our brains buffer sensory input for ~80ms to synchronize perception. Anything under 80ms feels instant and simultaneous. This is your target for micro-interactions.9293**Active vs passive time**: Passive waiting (staring at a spinner) feels longer than active engagement. Strategies to shift the balance:9495- **Preemptive start**: Begin transitions immediately while loading (iOS app zoom, skeleton UI). Users perceive work happening.96- **Early completion**: Show content progressively, don't wait for everything. Video buffering, progressive images, streaming HTML.97- **Optimistic UI**: Update the interface immediately, handle failures gracefully. Instagram likes work offline; the UI updates instantly, syncs later. Use for low-stakes actions; avoid for payments or destructive operations.9899**Easing affects perceived duration**: Ease-in (accelerating toward completion) makes tasks feel shorter because the peak-end effect weights final moments heavily. Ease-out feels satisfying for entrances, but ease-in toward a task's end compresses perceived time.100101**Caution**: Too-fast responses can decrease perceived value. Users may distrust instant results for complex operations (search, analysis). Sometimes a brief delay signals "real work" is happening.102103## Performance104105Don't use `will-change` preemptively, only when animation is imminent (`:hover`, `.animating`). For scroll-triggered animations, use Intersection Observer instead of scroll events; unobserve after animating once. Create motion tokens for consistency (durations, easings, common transitions).106107---108109**Avoid**: Animating everything (animation fatigue is real). Using >500ms for UI feedback. Ignoring `prefers-reduced-motion`. Using animation to hide slow loading.110