home / skills / dylantarre / animation-principles / web-motion-design

web-motion-design skill

/skills/01-by-domain/web-motion-design

This skill helps you implement Disney-inspired web motion principles in CSS, JS, and frontend frameworks to create cohesive, engaging UI animations.

npx playbooks add skill dylantarre/animation-principles --skill web-motion-design

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
3.5 KB
---
name: web-motion-design
description: Use when building CSS animations, JavaScript transitions, React/Vue motion, or any browser-based animation work.
---

# Web Motion Design

Apply Disney's 12 animation principles to CSS, JavaScript, and frontend frameworks.

## Quick Reference

| Principle | Web Implementation |
|-----------|-------------------|
| Squash & Stretch | `transform: scale()` on interaction states |
| Anticipation | Slight reverse movement before action |
| Staging | Focus user attention with motion hierarchy |
| Straight Ahead / Pose to Pose | JS frame-by-frame vs CSS keyframes |
| Follow Through / Overlapping | Staggered child animations, elastic easing |
| Slow In / Slow Out | `ease-in-out`, cubic-bezier curves |
| Arc | `motion-path` or bezier translate transforms |
| Secondary Action | Shadows, glows responding to primary motion |
| Timing | Duration: micro 100-200ms, standard 200-400ms |
| Exaggeration | Scale beyond 1.0, overshoot animations |
| Solid Drawing | Consistent transform-origin, 3D perspective |
| Appeal | Smooth 60fps, purposeful motion design |

## Principle Applications

**Squash & Stretch**: Apply `scaleY` compression on button press, `scaleX` stretch on hover. Keep volume constant—if you compress Y, expand X slightly.

**Anticipation**: Before expanding a dropdown, shrink it 2-3% first. Before sliding content left, move it 5px right.

**Staging**: Dim background elements during modal focus. Use motion to direct eye flow—animate important elements first.

**Straight Ahead vs Pose to Pose**: Use CSS `@keyframes` for predictable, repeatable animations (pose to pose). Use JavaScript/GSAP for dynamic, physics-based motion (straight ahead).

**Follow Through & Overlapping**: Child elements should complete movement after parent stops. Use `animation-delay` with decreasing values for natural stagger.

**Slow In / Slow Out**: Never use `linear` for UI motion. Standard easing: `cubic-bezier(0.4, 0, 0.2, 1)`. Enter: `cubic-bezier(0, 0, 0.2, 1)`. Exit: `cubic-bezier(0.4, 0, 1, 1)`.

**Arc**: Elements in nature move in arcs, not straight lines. Use `offset-path` or combine X/Y transforms with different easings.

**Secondary Action**: Button shadow grows/blurs on hover. Icon inside button rotates while button scales. Background particles respond to primary element.

**Timing**: Micro-interactions: 100-200ms. Standard transitions: 200-400ms. Complex sequences: 400-700ms. Page transitions: 300-500ms.

**Exaggeration**: Hover states scale to 1.05-1.1, not 1.01. Error shakes move 10-20px, not 2px. Make motion noticeable but not jarring.

**Solid Drawing**: Maintain consistent `transform-origin`. Use `perspective` for 3D depth. Avoid conflicting transforms that create visual glitches.

**Appeal**: Target 60fps—use `transform` and `opacity` only when possible. Add subtle personality through custom easing curves. Motion should feel intentional.

## Code Patterns

```css
/* Elastic button with squash/stretch */
.button:active {
  transform: scale(0.95, 1.05);
  transition: transform 100ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Anticipation before expansion */
.dropdown-enter {
  animation: dropdown-open 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes dropdown-open {
  0% { transform: scaleY(0.98); opacity: 0; }
  100% { transform: scaleY(1); opacity: 1; }
}
```

## Performance Rules

1. Animate only `transform` and `opacity` for GPU acceleration
2. Use `will-change` sparingly and remove after animation
3. Prefer CSS over JavaScript when animation is predictable
4. Test on low-powered devices

Overview

This skill teaches how to apply Disney’s 12 animation principles to CSS, JavaScript, and frontend frameworks to create purposeful, high-quality web motion. It focuses on practical patterns, timing guidelines, and performance rules for building micro-interactions, component transitions, and page motion. The content emphasizes readable code patterns and predictable, high-performance motion for modern browsers.

How this skill works

The skill maps each animation principle to concrete web techniques (transforms, keyframes, easing, motion-paths, stagger, etc.) and provides ready patterns for buttons, dropdowns, and sequences. It explains when to use CSS keyframes versus JavaScript-driven motion, prescribes timing scales for different interaction types, and lists performance rules to keep animations at 60fps. Code snippets illustrate squash & stretch, anticipation, stagger, and easing choices.

When to use it

  • Designing micro-interactions like button presses, toggles, and hover states
  • Animating component enter/exit transitions (modals, dropdowns, toasts)
  • Building complex UI sequences with staggered child motion
  • Implementing physics-driven motion in JS/GSAP for dynamic content
  • Optimizing animations for mobile and low-powered devices

Best practices

  • Animate only transform and opacity for GPU-accelerated, smooth motion
  • Use CSS keyframes for predictable, repeatable effects; use JS for dynamic or physics-based motion
  • Follow timing scales: micro 100–200ms, standard 200–400ms, complex 400–700ms
  • Prefer cubic-bezier easing for slow in / slow out; avoid linear for UI
  • Use will-change sparingly and remove it after animation to avoid memory costs
  • Test on low-powered devices and keep motion purposeful, not decorative

Example use cases

  • Elastic button press with squash & stretch using transform scale and 100ms transition
  • Dropdown anticipation: tiny reverse movement before expansion implemented via keyframes
  • Staggered card entrance where child elements follow through with decreasing delays
  • Page transition using opacity + translate with 300–500ms timing and custom easing
  • Icon secondary actions: rotate or glow while the parent element moves

FAQ

When should I use JavaScript instead of pure CSS for motion?

Use JavaScript or a library like GSAP when motion must respond to runtime data, physics, or unpredictable state. Use CSS for repeatable, state-driven transitions for better performance.

How do I keep animations performant on mobile?

Animate transform and opacity only, limit simultaneous animations, use will-change sparingly, and test on low-end devices to tune durations and easing.