home / skills / dylantarre / animation-principles / universal-patterns

This skill applies universal animation patterns from Disney principles to establish timing, easing, and motion baseline across interfaces.

npx playbooks add skill dylantarre/animation-principles --skill universal-patterns

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

Files (1)
SKILL.md
3.4 KB
---
name: universal-patterns
description: Use when creating any animation type - provides foundational timing, easing, and principle application that applies to all motion in interfaces.
---

# Universal Animation Patterns

Apply Disney's 12 principles as baseline defaults for any animation.

## Core Timing Scale

| Category | Duration | Use For |
|----------|----------|---------|
| Instant | 100-150ms | Hovers, toggles, micro-states |
| Fast | 150-250ms | Feedback, small transitions |
| Standard | 250-400ms | Modals, reveals, state changes |
| Slow | 400-600ms | Page transitions, sequences |
| Deliberate | 600-1000ms | Dramatic reveals, celebrations |

## Universal Easing Library

```css
:root {
  /* Standard easings */
  --ease-out: cubic-bezier(0, 0, 0.2, 1);        /* Entrances */
  --ease-in: cubic-bezier(0.4, 0, 1, 1);         /* Exits */
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);   /* State changes */

  /* Spring easings */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);  /* Overshoot */
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.27, 1.55); /* Playful */
}
```

## The 12 Principles Quick Reference

1. **Squash & Stretch**: Scale 0.95-1.05 range for organic feel
2. **Anticipation**: 2-3px reverse movement or 50ms pause before action
3. **Staging**: Animate toward user attention, clear visual hierarchy
4. **Straight Ahead vs Pose-to-Pose**: Define keyframes, plan states
5. **Follow Through**: Overshoot by 2-5%, settle back
6. **Slow In/Slow Out**: Always ease, never linear (except spinners)
7. **Arcs**: Combine X+Y movement, natural paths
8. **Secondary Action**: Layer 2-3 properties max (opacity + transform + shadow)
9. **Timing**: Match duration to distance/importance
10. **Exaggeration**: Subtle for UI (under 10% deviation)
11. **Solid Drawing**: Maintain visual consistency during motion
12. **Appeal**: Motion should feel helpful, not performative

## Base Animation Classes

```css
/* Standard entrance */
.animate-in {
  animation: fade-in 250ms var(--ease-out) forwards;
}

/* Standard exit */
.animate-out {
  animation: fade-out 200ms var(--ease-in) forwards;
}

/* State transition */
.animate-state {
  transition: all 200ms var(--ease-in-out);
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-10px); }
}
```

## Universal Rules

1. **100ms Response Time**: User actions must trigger visible change within 100ms
2. **Under 400ms for UI**: Functional animations shouldn't exceed 400ms
3. **Reduce Motion**: Always provide `prefers-reduced-motion` alternative
4. **GPU Properties**: Use only `transform` and `opacity` for smooth 60fps
5. **Exit < Enter**: Exits 20-30% faster than entrances

## Accessibility Default

```css
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
```

## Decision Tree

1. Is element entering? → Use ease-out, 200-300ms
2. Is element exiting? → Use ease-in, 150-250ms
3. Is element changing state? → Use ease-in-out, 150-250ms
4. Is it continuous? → Use linear (rotation) or ease-in-out (pulse)
5. Is it responding to gesture? → Use ease-out with overshoot, under 200ms

When uncertain, start with: `250ms cubic-bezier(0.4, 0, 0.2, 1)`

Overview

This skill provides a compact, practical set of universal animation patterns based on Disney’s 12 principles to use when creating any animation type. It supplies recommended timing scales, easing presets, core CSS classes, accessibility defaults, and a simple decision tree so designers and engineers can consistently deliver natural, performant motion across interfaces.

How this skill works

It inspects the animation intent (enter, exit, state change, continuous, gesture) and maps that intent to a timing category, easing curve, and property guidelines. It includes base CSS classes and keyframes for quick implementation, a universal easing library, and hard rules for performance and accessibility (prefers-reduced-motion, GPU-friendly properties). Use the decision tree to pick defaults, then tune using the 12 principles for personality and clarity.

When to use it

  • Creating entrance, exit, or state-change animations for UI components
  • Designing micro-interactions like hovers, toggles, and feedback
  • Building page transitions or sequenced animations
  • Implementing motion system defaults for a design system
  • Optimizing animations for performance and accessibility

Best practices

  • Start with the core timing scale: Instant (100–150ms) to Deliberate (600–1000ms) and pick closest match
  • Favor transform and opacity for smooth 60fps; avoid layout-triggering properties
  • Use ease-out for entrances, ease-in for exits, ease-in-out for state changes; exit durations ~20–30% faster
  • Apply at most 2–3 layered properties for secondary actions (opacity + transform + shadow)
  • Respect prefers-reduced-motion by providing near-instant alternatives
  • Use subtle exaggeration (<10%) and small squash/stretch ranges (0.95–1.05) for organic feel

Example use cases

  • Modal entrance: 250–350ms with ease-out and slight overshoot on scale
  • Button press: 100–150ms instant feedback with 2–3px anticipation and quick follow-through
  • Toast notifications: Standard 250–400ms entrance, faster 150–250ms exit
  • Page transition: Slow 400–600ms sequence with layered secondary actions
  • Continuous spinner: Linear rotation with reduced-motion alternative

FAQ

How do I choose duration for a new animation?

Match importance and distance: micro-states use Instant/ Fast, key UI changes use Standard, and dramatic reveals use Slow/Deliberate. When unsure, start at 250ms with cubic-bezier(0.4, 0, 0.2, 1).

Which properties are safe for high performance?

Use transform and opacity only; these avoid layout and are GPU-friendly for consistent 60fps.

How do I support reduced motion users?

Respect prefers-reduced-motion by minimizing animation durations to near-instant and removing nonessential motion while preserving functionality.