Motion Dev Animations
Motion.dev - 10M+ downloads/month, successor to Framer Motion
120fps GPU-accelerated animations for React, Next.js, Svelte, Astro, Vue
Purpose
Generate production-grade animations using Motion.dev following Apple/Jon Ive principles:
Purposeful (serves function) | Smooth (120fps) | Accessible (reduced-motion) | Performant (GPU-only) | Elegant (subtle) | Consistent (unified timing)
When to Use
✅ Use for:
- React 19+/Next.js 15+/Svelte 5+/Astro 4+ animation implementation
- Scroll effects (parallax, reveal), gestures (hover, drag, tap), layout animations
- Hero sections, cards, micro-interactions requiring 60fps+ performance
- Projects needing spring physics, natural motion, accessibility
❌ Don't use for:
- CSS-only transitions (use native
transition property)
- Static sites without JavaScript frameworks
- Vue projects (use
motion-v package - different API)
- SVG/Canvas complex animations (GSAP better suited)
- Form-only CRUD apps (overkill)
Workflow: Clarify → Plan → Implement → Verify
Step 1: Clarify Requirements
Determine project context and animation goals:
- Framework (React 19+, Next.js 15+, Svelte 5+, Astro 4+)
- Animation type (entrance, gesture, scroll, layout)
- Design goal (subtle, prominent, playful, professional)
- Performance constraints (target device, bundle limits, accessibility requirements)
- Trigger mechanism (mount, viewport, user interaction)
Step 2: Plan Animation Strategy
Define implementation approach:
- Components to animate (headers, cards, buttons, sections)
- Motion patterns (fade, slide, scale, spring, parallax)
- Timing specifications (duration, delay, stagger intervals)
- Physics parameters (stiffness: 300-400, damping: 20, mass: 1)
- Accessibility fallbacks (prefers-reduced-motion alternatives)
Step 3: Implement in Phases
Build animations incrementally:
- Setup: Install Motion.dev, configure imports, prepare component structure
- Core Animation: Apply motion properties (initial, animate, transition)
- Refinement: Tune timing, easing curves, spring physics for natural feel
- Accessibility: Add reduced-motion detection, keyboard navigation support
- Optimization: Verify GPU-acceleration, minimize bundle size, test performance
Step 4: Verify Quality Standards
Check against requirements:
- Performance: ≥60fps (Chrome DevTools → Performance tab)
- Layout Stability: CLS = 0 (Lighthouse audit)
- Accessibility: Honors prefers-reduced-motion (system settings test)
- Keyboard Navigation: All interactive elements keyboard-accessible
- Mobile Responsive: Touch-friendly gestures, tested on iOS/Android
Animation Pattern Decision Tree
INPUT: What should animate?
├─ ENTRANCE (page load, mount)
│ → Pattern: initial={{opacity: 0, y: 20}} animate={{opacity: 1, y: 0}}
│ → Timing: 0.6-0.8s, ease: [0.22, 1, 0.36, 1]
│ → Stagger: 0.1-0.2s between elements
│ → Example: ./examples/hero-fade-up.md
│
├─ GESTURE (hover, tap, drag)
│ → Pattern: whileHover={{scale: 1.05}}, whileTap={{scale: 0.95}}
│ → Physics: Spring (stiffness: 300-400, damping: 20)
│ → Timing: Instant response (no duration)
│ → Examples: ./examples/card-hover.md, ./examples/magnetic-button.md
│
├─ SCROLL (reveal, parallax)
│ → Pattern: whileInView + viewport OR useScroll + useTransform
│ → Trigger: viewport={{once: true, amount: 0.3}}
│ → Performance: Transform/opacity only
│ → Examples: ./examples/scroll-reveal.md, ./examples/parallax-layers.md
│
└─ LAYOUT (reorder, expand)
→ Pattern: layout prop (auto FLIP)
→ Shared: layoutId="id" for morphing
→ Caveat: Only animates transforms
API Quick Reference
| Component/Hook |
Usage |
When |
| motion.div |
<motion.div animate={{x: 100}}> |
Basic animations |
| whileHover |
whileHover={{scale: 1.05}} |
Hover states (0.2-0.3s) |
| whileTap |
whileTap={{scale: 0.95}} |
Click feedback |
| whileInView |
whileInView={{opacity: 1}} |
Scroll reveal |
| drag |
drag="x" dragConstraints |
Draggable elements |
| layout |
<motion.div layout /> |
Auto FLIP animation |
| useScroll |
Track scroll progress |
Parallax, progress bars |
| useTransform |
Map values |
Scroll-linked effects |
| useSpring |
Spring physics |
Smooth value changes |
| useInView |
Viewport detection |
Trigger animations |
Full API: See Complete API Reference
Framework Integration
| Framework |
Import |
Components |
Exit Animations |
| React/Next.js |
"motion/react" |
<motion.div> |
<AnimatePresence> |
| Svelte |
"motion" |
Vanilla API |
N/A |
| Astro |
"motion" |
Client scripts |
N/A |
| Vue |
"motion-v" |
<motion.div> |
Similar to React |
Quality Standards
| Category |
Requirement |
How to Verify |
| Performance |
≥60fps |
Chrome DevTools → Performance |
| GPU-accel |
transform/opacity only |
No width/height/left/top |
| Bundle |
<50KB |
webpack-bundle-analyzer |
| Accessibility |
prefers-reduced-motion |
System settings test |
| Mobile |
Touch-friendly |
iOS/Android testing |
| Layout shift |
CLS = 0 |
Lighthouse audit |
Examples Library (Progressive Loading)
Load on-demand based on animation type:
Hero Sections
- Hero Fade Up - Classic Apple-style entrance
- Hero Stagger - Orchestrated elements
- Hero Split Text - Character reveal
Scroll Effects
Gestures & Interactions
Layout Animations
- List Reorder - Drag-to-reorder FLIP
- Accordion - Expand/collapse
- Tab Switch - Shared layout
Full examples: All files in ./examples/ directory
Reference Documentation (Load On-Demand)
- Complete API Reference - All components, hooks, props
- Spring Physics Guide - Tuning stiffness, damping, mass
- Performance Optimization - GPU, will-change, lazy loading
- Accessibility Guide - Reduced motion, keyboard, screen readers
- Troubleshooting - Common issues, solutions
- Framer Motion Migration - Upgrade guide
Templates (Production-Ready)
- Next.js Page Template - Hero + features + testimonials
- Component Library - 10+ reusable components
- Scroll Template - Parallax + reveal patterns
- Dashboard Template - Interactive cards, charts
Installation
# React/Next.js/Svelte/Astro
npm install motion
# Vue
npm install motion-v
Common Patterns (Copy-Paste Ready)
Pattern 1: Fade Up Entrance
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.6, ease: [0.22, 1, 0.36, 1] }}
/>
Pattern 2: Hover Card
<motion.div
whileHover={{ y: -8, boxShadow: "0 20px 40px rgba(0,0,0,0.12)" }}
transition={{ type: "spring", stiffness: 300, damping: 20 }}
/>
Pattern 3: Scroll Reveal
<motion.div
initial={{ opacity: 0, y: 50 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, amount: 0.3 }}
/>
More patterns: Staggered lists, exit animations, layout transitions → ./examples/ directory
Error Handling
| Issue |
Solution |
| Animation doesn't trigger |
Check initial ≠ animate values |
| Poor performance |
Use transform/opacity only + will-change CSS |
| Layout shift |
Set explicit dimensions, use layout prop |
| Exit not working |
Wrap with <AnimatePresence>, add key prop |
Implementation Best Practices
- Start simple → Build from fade + slide, add complexity incrementally
- Extract variants → Define animation states as named variants for maintainability
- Prefer spring physics → Default to spring transitions (more natural than tween)
- Stagger list items → Use staggerChildren (0.1-0.2s) for rhythm and hierarchy
- Test mobile thoroughly → Verify touch gestures, performance on iOS/Android devices
- Include reduced-motion → Always provide prefers-reduced-motion fallback animations
- Profile performance → Use Chrome DevTools Performance tab, target ≥60fps
Design Philosophy (Apple/Jon Ive Principles)
Apply these design principles to all animations:
- Simplicity: Use 200-400ms durations, minimize simultaneous motion, prefer transform properties
- Natural Physics: Implement spring-based transitions, avoid linear easing, apply mass-based movement
- Purposeful Motion: Guide user attention, provide interaction feedback, establish visual hierarchy
- Elegant Restraint: Apply "less is more" principle, maintain consistent timing, respect user motion preferences
Validation
For structured output validation, see:
Metadata
Version: 3.0.0 (Research-Backed Optimization)
Optimization: Imperative language, few-shot patterns (3 examples), layered complexity, progressive loading
Token Efficiency: 87% core reduction (15K → 2K) + auto-caching
Motion.dev: v11+
Frameworks: React 19+, Next.js 15+, Svelte 5+, Astro 4+, Vue 3+
Research: arXiv 2402.07927v1, 2211.01910, 2310.14735v5, PubMed 40334089
License: MIT
1---2name: motion-dev-animations3description: Creates 120fps GPU-accelerated animations with Motion.dev (Framer Motion successor) for React, Next.js, Svelte, and Astro projects. Use when user requests animation, motion, scroll effects, parallax, hero animations, gestures, drag interactions, spring physics, whileHover effects, whileInView animations, animated UI, micro-interactions, page transitions, or layout animations. Generates production TypeScript/JSX code with accessibility (prefers-reduced-motion) and performance validation (≥60fps). Supports entrance animations, gesture interactions (hover/tap/drag), scroll-based reveals, and layout transitions using spring physics and natural timing. Do NOT use for CSS-only transitions (use native CSS), static sites without JavaScript, Vue animations (use motion-v variant instead), or SVG/Canvas complex animations (GSAP better suited).4---5
6# Motion Dev Animations
7
8> **Motion.dev** - 10M+ downloads/month, successor to Framer Motion
9> 120fps GPU-accelerated animations for React, Next.js, Svelte, Astro, Vue
10
11## Purpose
12
13Generate production-grade animations using Motion.dev following Apple/Jon Ive principles:
14**Purposeful** (serves function) | **Smooth** (120fps) | **Accessible** (reduced-motion) | **Performant** (GPU-only) | **Elegant** (subtle) | **Consistent** (unified timing)
15
16## When to Use
17
18✅ **Use for**:
19- React 19+/Next.js 15+/Svelte 5+/Astro 4+ animation implementation
20- Scroll effects (parallax, reveal), gestures (hover, drag, tap), layout animations
21- Hero sections, cards, micro-interactions requiring 60fps+ performance
22- Projects needing spring physics, natural motion, accessibility
23
24❌ **Don't use for**:
25- CSS-only transitions (use native `transition` property)
26- Static sites without JavaScript frameworks
27- Vue projects (use `motion-v` package - different API)
28- SVG/Canvas complex animations (GSAP better suited)
29- Form-only CRUD apps (overkill)
30
31## Workflow: Clarify → Plan → Implement → Verify
32
33### Step 1: Clarify Requirements
34Determine project context and animation goals:
35- Framework (React 19+, Next.js 15+, Svelte 5+, Astro 4+)
36- Animation type (entrance, gesture, scroll, layout)
37- Design goal (subtle, prominent, playful, professional)
38- Performance constraints (target device, bundle limits, accessibility requirements)
39- Trigger mechanism (mount, viewport, user interaction)
40
41### Step 2: Plan Animation Strategy
42Define implementation approach:
43- Components to animate (headers, cards, buttons, sections)
44- Motion patterns (fade, slide, scale, spring, parallax)
45- Timing specifications (duration, delay, stagger intervals)
46- Physics parameters (stiffness: 300-400, damping: 20, mass: 1)
47- Accessibility fallbacks (prefers-reduced-motion alternatives)
48
49### Step 3: Implement in Phases
50Build animations incrementally:
51- **Setup**: Install Motion.dev, configure imports, prepare component structure
52- **Core Animation**: Apply motion properties (initial, animate, transition)
53- **Refinement**: Tune timing, easing curves, spring physics for natural feel
54- **Accessibility**: Add reduced-motion detection, keyboard navigation support
55- **Optimization**: Verify GPU-acceleration, minimize bundle size, test performance
56
57### Step 4: Verify Quality Standards
58Check against requirements:
59- **Performance**: ≥60fps (Chrome DevTools → Performance tab)
60- **Layout Stability**: CLS = 0 (Lighthouse audit)
61- **Accessibility**: Honors prefers-reduced-motion (system settings test)
62- **Keyboard Navigation**: All interactive elements keyboard-accessible
63- **Mobile Responsive**: Touch-friendly gestures, tested on iOS/Android
64
65## Animation Pattern Decision Tree
66
67```
68INPUT: What should animate?
69
70├─ ENTRANCE (page load, mount)
71│ → Pattern: initial={{opacity: 0, y: 20}} animate={{opacity: 1, y: 0}}
72│ → Timing: 0.6-0.8s, ease: [0.22, 1, 0.36, 1]
73│ → Stagger: 0.1-0.2s between elements
74│ → Example: ./examples/hero-fade-up.md
75│
76├─ GESTURE (hover, tap, drag)
77│ → Pattern: whileHover={{scale: 1.05}}, whileTap={{scale: 0.95}}
78│ → Physics: Spring (stiffness: 300-400, damping: 20)
79│ → Timing: Instant response (no duration)
80│ → Examples: ./examples/card-hover.md, ./examples/magnetic-button.md
81│
82├─ SCROLL (reveal, parallax)
83│ → Pattern: whileInView + viewport OR useScroll + useTransform
84│ → Trigger: viewport={{once: true, amount: 0.3}}
85│ → Performance: Transform/opacity only
86│ → Examples: ./examples/scroll-reveal.md, ./examples/parallax-layers.md
87│
88└─ LAYOUT (reorder, expand)
89 → Pattern: layout prop (auto FLIP)
90 → Shared: layoutId="id" for morphing
91 → Caveat: Only animates transforms
92```
93
94## API Quick Reference
95
96| Component/Hook | Usage | When |
97|----------------|-------|------|
98| **motion.div** | `<motion.div animate={{x: 100}}>` | Basic animations |
99| **whileHover** | `whileHover={{scale: 1.05}}` | Hover states (0.2-0.3s) |
100| **whileTap** | `whileTap={{scale: 0.95}}` | Click feedback |
101| **whileInView** | `whileInView={{opacity: 1}}` | Scroll reveal |
102| **drag** | `drag="x"` dragConstraints | Draggable elements |
103| **layout** | `<motion.div layout />` | Auto FLIP animation |
104| **useScroll** | Track scroll progress | Parallax, progress bars |
105| **useTransform** | Map values | Scroll-linked effects |
106| **useSpring** | Spring physics | Smooth value changes |
107| **useInView** | Viewport detection | Trigger animations |
108
109**Full API**: See [Complete API Reference](./reference/api-reference.md)
110
111## Framework Integration
112
113| Framework | Import | Components | Exit Animations |
114|-----------|--------|------------|-----------------|
115| **React/Next.js** | `"motion/react"` | `<motion.div>` | `<AnimatePresence>` |
116| **Svelte** | `"motion"` | Vanilla API | N/A |
117| **Astro** | `"motion"` | Client scripts | N/A |
118| **Vue** | `"motion-v"` | `<motion.div>` | Similar to React |
119
120## Quality Standards
121
122| Category | Requirement | How to Verify |
123|----------|-------------|---------------|
124| **Performance** | ≥60fps | Chrome DevTools → Performance |
125| **GPU-accel** | transform/opacity only | No width/height/left/top |
126| **Bundle** | <50KB | webpack-bundle-analyzer |
127| **Accessibility** | prefers-reduced-motion | System settings test |
128| **Mobile** | Touch-friendly | iOS/Android testing |
129| **Layout shift** | CLS = 0 | Lighthouse audit |
130
131## Examples Library (Progressive Loading)
132
133Load on-demand based on animation type:
134
135### Hero Sections
136- [Hero Fade Up](./examples/hero-fade-up.md) - Classic Apple-style entrance
137- Hero Stagger - Orchestrated elements
138- Hero Split Text - Character reveal
139
140### Scroll Effects
141- [Scroll Reveal](./examples/scroll-reveal.md) - Intersection Observer fade-in
142- [Parallax Layers](./examples/parallax-layers.md) - Multi-speed depth
143- Scroll Progress - Reading indicator
144
145### Gestures & Interactions
146- [Card Hover](./examples/card-hover.md) - Elegant lift + shadow
147- [Magnetic Button](./examples/magnetic-button.md) - Cursor-following
148- Drag Carousel - Touch slider
149
150### Layout Animations
151- List Reorder - Drag-to-reorder FLIP
152- Accordion - Expand/collapse
153- Tab Switch - Shared layout
154
155**Full examples**: All files in `./examples/` directory
156
157## Reference Documentation (Load On-Demand)
158
159- [Complete API Reference](./reference/api-reference.md) - All components, hooks, props
160- [Spring Physics Guide](./reference/spring-physics.md) - Tuning stiffness, damping, mass
161- Performance Optimization - GPU, will-change, lazy loading
162- Accessibility Guide - Reduced motion, keyboard, screen readers
163- Troubleshooting - Common issues, solutions
164- Framer Motion Migration - Upgrade guide
165
166## Templates (Production-Ready)
167
168- [Next.js Page Template](./templates/nextjs-page.tsx) - Hero + features + testimonials
169- [Component Library](./templates/component-library.tsx) - 10+ reusable components
170- Scroll Template - Parallax + reveal patterns
171- Dashboard Template - Interactive cards, charts
172
173## Installation
174
175```bash
176# React/Next.js/Svelte/Astro
177npm install motion
178
179# Vue
180npm install motion-v
181```
182
183## Common Patterns (Copy-Paste Ready)
184
185### Pattern 1: Fade Up Entrance
186```tsx
187<motion.div
188 initial={{ opacity: 0, y: 20 }}
189 animate={{ opacity: 1, y: 0 }}
190 transition={{ duration: 0.6, ease: [0.22, 1, 0.36, 1] }}
191/>
192```
193
194### Pattern 2: Hover Card
195```tsx
196<motion.div
197 whileHover={{ y: -8, boxShadow: "0 20px 40px rgba(0,0,0,0.12)" }}
198 transition={{ type: "spring", stiffness: 300, damping: 20 }}
199/>
200```
201
202### Pattern 3: Scroll Reveal
203```tsx
204<motion.div
205 initial={{ opacity: 0, y: 50 }}
206 whileInView={{ opacity: 1, y: 0 }}
207 viewport={{ once: true, amount: 0.3 }}
208/>
209```
210
211**More patterns**: Staggered lists, exit animations, layout transitions → `./examples/` directory
212
213## Error Handling
214
215| Issue | Solution |
216|-------|----------|
217| Animation doesn't trigger | Check initial ≠ animate values |
218| Poor performance | Use transform/opacity only + will-change CSS |
219| Layout shift | Set explicit dimensions, use layout prop |
220| Exit not working | Wrap with `<AnimatePresence>`, add key prop |
221
222## Implementation Best Practices
223
2241. **Start simple** → Build from fade + slide, add complexity incrementally
2252. **Extract variants** → Define animation states as named variants for maintainability
2263. **Prefer spring physics** → Default to spring transitions (more natural than tween)
2274. **Stagger list items** → Use staggerChildren (0.1-0.2s) for rhythm and hierarchy
2285. **Test mobile thoroughly** → Verify touch gestures, performance on iOS/Android devices
2296. **Include reduced-motion** → Always provide prefers-reduced-motion fallback animations
2307. **Profile performance** → Use Chrome DevTools Performance tab, target ≥60fps
231
232## Design Philosophy (Apple/Jon Ive Principles)
233
234Apply these design principles to all animations:
235
236- **Simplicity**: Use 200-400ms durations, minimize simultaneous motion, prefer transform properties
237- **Natural Physics**: Implement spring-based transitions, avoid linear easing, apply mass-based movement
238- **Purposeful Motion**: Guide user attention, provide interaction feedback, establish visual hierarchy
239- **Elegant Restraint**: Apply "less is more" principle, maintain consistent timing, respect user motion preferences
240
241## Validation
242
243For structured output validation, see:
244- [Motion Config Schema](./schema/motion-config.schema.json) - JSON schema
245- [Validation Script](./scripts/validate_motion_config.py) - Automated checks
246
247## Metadata
248
249**Version**: 3.0.0 (Research-Backed Optimization)
250**Optimization**: Imperative language, few-shot patterns (3 examples), layered complexity, progressive loading
251**Token Efficiency**: 87% core reduction (15K → 2K) + auto-caching
252**Motion.dev**: v11+
253**Frameworks**: React 19+, Next.js 15+, Svelte 5+, Astro 4+, Vue 3+
254**Research**: arXiv 2402.07927v1, 2211.01910, 2310.14735v5, PubMed 40334089
255**License**: MIT