⌘+\

Motion Practice

Spinner Button

React

Spring-based animations with React and Framer Motion

Spinner Button

Pure CSS

CSS + JS Animation. Framer Motion is cleaner. Wasn't able to get the exit/entry animations to work with @starting-style properly. It should be possible — but short on time.

Sonner Card Stack

Pure CSS

index: 0 ReverseIndex: 5 Reversing the index, deducting 1 to get 0 (set initial state) Scale Calc: 0.75 1 - `5` * 0.05 Translate Calc: 150% `5` * 30%
index: 1 ReverseIndex: 4 Reversing the index, deducting 1 to get 0 (set initial state) Scale Calc: 0.8 1 - `4` * 0.05 Translate Calc: 120% `4` * 30%
index: 2 ReverseIndex: 3 Reversing the index, deducting 1 to get 0 (set initial state) Scale Calc: 0.85 1 - `3` * 0.05 Translate Calc: 90% `3` * 30%
index: 3 ReverseIndex: 2 Reversing the index, deducting 1 to get 0 (set initial state) Scale Calc: 0.9 1 - `2` * 0.05 Translate Calc: 60% `2` * 30%
index: 4 ReverseIndex: 1 Reversing the index, deducting 1 to get 0 (set initial state) Scale Calc: 0.95 1 - `1` * 0.05 Translate Calc: 30% `1` * 30%
index: 5 ReverseIndex: 0 Reversing the index, deducting 1 to get 0 (set initial state) Scale Calc: 1 1 - `0` * 0.05 Translate Calc: 0% `0` * 30%

Sonner Card Stack Animation

Pure CSS

Tranlate Y

Motion TODO

Topics to Cover

Easing Curves Guide

Ease-Out

When to Use:

Ease-In-Out

When to Use:

Ease-In

When to Use:

Linear

When to Use:

Ease

When to Use:

Custom Easings

When to Use:

Creating Custom Curves

Timing (Duration):

General Guideline: 200-300ms for most animations (sweet spot aligning with human reaction time). Hover Transitions: 150ms or even less (user is already focused, sensitive to color/opacity changes). Modal/Popover Enter: 200ms. Modal/Popover Exit: 150ms. Large View Changes: Longer durations (e.g., Vercel’s Time Machine at 1 second). Steep Easing Curves: May require longer durations to avoid feeling too abrupt (e.g. Vaul example using 500ms). Default for Modals: 200ms with ease-out. Adjust if needed. Perceived Speed: Shorter is generally better; animations longer than 700ms should be rare. Exception: loading spinners should never be slow. Iteration: Take breaks; perception of speed changes with prolonged work. Purpose:

Primary Goal: Add context and clarity to the user experience. Self-Check: Can you easily explain the benefit the animation provides? Examples of Purposeful Animation: Explaining concepts or processes (e.g., Vercel’s v0 animation). Indicating state changes (e.g., App Store cards). When NOT to Animate: High-frequency interactions (e.g., Raycast’s command menu). Keyboard interactions (can feel slow and disconnected). Delight: Use sparingly and thoughtfully. Combine expected animations (enter/exit) with a few well-crafted ones for delight. Prioritize tastefulness and elegance over quantity. Key Takeaway:

Animation should be purposeful, enhancing understanding and usability. Timing should be carefully considered to balance responsiveness with clarity. Delightful animations should be used judiciously to create a positive, engaging experience without overwhelming the user.