A comprehensive, centralized animation system with:
- 6 animation categories: entrance, exit, promote, remove, confirm, danger
- 25+ named presets covering common UI patterns
- Automatic reduced-motion support - respects
prefers-reduced-motionsystem setting - Type-safe Framer Motion integration - works seamlessly with existing animations
- Duration and easing presets for consistency
- Combined patterns for common UI workflows (modals, notifications, sidebars, etc.)
A development-only QA panel accessible at /motion-gallery (dev mode only) featuring:
- Interactive preview of all animation presets
- Reduced-motion simulation toggle for accessibility testing
- Live animation replay controls
- Usage code examples for each preset
- Implementation patterns with copy-able code
- Accessibility guidelines and best practices
- Documentation links to full reference
src/lib/MOTION_PRESETS.md- Full API reference with examplessrc/features/design-system/README.md- Updated with motion system overview- JSDoc comments on all presets with usage guidance
import { motionPresets } from "@/lib/motion-presets";
import { motion, AnimatePresence } from "framer-motion";
// Simple entrance animation
<motion.div {...motionPresets.entrance.slideUp()}>
Content slides up with fade
</motion.div>
// Interactive hover effect
<motion.button {...motionPresets.promote.scale(1.04)}>
Click me
</motion.button>
// Paired entrance/exit with AnimatePresence
<AnimatePresence>
{isOpen && (
<motion.div
{...motionPresets.entrance.slideUp()}
exit={motionPresets.exit.slideDown()}
>
Modal content
</motion.div>
)}
</AnimatePresence>In development mode, visit:
http://localhost:5173/motion-gallery
This provides an interactive reference for all available animations without needing to trigger workflows manually.
| Category | Purpose | Examples |
|---|---|---|
| entrance | Elements appearing/entering | slideUp, fadeIn, scaleIn, slideLeft, slideRight |
| exit | Elements disappearing/leaving | slideDown, fadeOut, scaleOut, slideToLeft, slideToRight |
| promote | Drawing attention | scale, lift, glow (use with whileHover/whileTap) |
| remove | Removal emphasis | spinOut, collapse, slideAwayRight |
| confirm | Success feedback | bounce, pulse, checkmark |
| danger | Error/warning feedback | shake, pulse, spinWarn |
✅ Accessibility First
- All presets respect
prefers-reduced-motionpreference - Reduced motion reduces durations to ~0.01ms
- Works with keyboard navigation focus states
✅ Consistent & Testable
- Named presets prevent hardcoding animation values
- Gallery allows QA to review all animations
- Spring physics provides natural, responsive motion
✅ Developer Friendly
- TypeScript support with full type safety
- JSDoc documentation on every preset
- Copy-paste code examples in gallery
- Minimal API surface - easy to learn
✅ Production Ready
- Dev-only gallery doesn't affect production builds
- Zero runtime overhead beyond Framer Motion
- Follows existing design system patterns
src/
├── lib/
│ ├── motion-presets.ts # Main motion system (400+ lines)
│ └── MOTION_PRESETS.md # Full documentation
├── routes/
│ └── motion-gallery.tsx # Dev-only QA panel
└── features/
└── design-system/
└── README.md # Updated with motion docs
<motion.div {...motionPresets.patterns.modal.backdrop} />
<motion.div {...motionPresets.patterns.modal.content} /><motion.div {...motionPresets.patterns.notification.entrance} />
<motion.div {...motionPresets.patterns.notification.exit} /><motion.div {...motionPresets.patterns.sidePanel.backdrop} />
<motion.div {...motionPresets.patterns.sidePanel.panel} /><motion.div {...motionPresets.patterns.listItem.entrance} />
<motion.div {...motionPresets.patterns.listItem.exit} />- Design & Test - Use
/motion-galleryto preview animations - Implement - Import presets and apply to components
- Review - Verify animations in context
- Iterate - Adjust preset parameters if needed
- QA - Test with reduced-motion toggle enabled
- ✅ Respects system
prefers-reduced-motionsetting - ✅ All animations are optional (content remains accessible)
- ✅ No animations block user interaction
- ✅ Works with keyboard navigation
- ✅ Compatible with screen readers (motion doesn't interfere)
- Spring animations use GPU acceleration
- Transitions are kept under 500ms for responsiveness
- Multiple simultaneous animations are limited
- Animations respect browser frame rate (60fps target)
- Modals - Use
patterns.modalfor consistent appearance/disappearance - Notifications - Use
patterns.notificationfor toast patterns - Forms - Use
confirmpresets for success states,dangerfor errors - Lists - Use
entrance.slideUpwith staggered delays for list items - Navigation - Use
promote.scalefor interactive buttons
# Start dev server
npm run dev
# Visit gallery
http://localhost:5173/motion-gallery
# Toggle "Reduced Motion" to test accessibility
# Click "Replay" to review animations repeatedly- Framer Motion Docs: https://www.framer.com/motion/
- Accessibility (prefers-reduced-motion): https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion
- Web.dev on Animations: https://web.dev/animations/
- Design System:
src/features/design-system/README.md
Refer to:
- Gallery -
/motion-galleryfor visual examples - Full Docs -
src/lib/MOTION_PRESETS.mdfor API reference - Examples - Implementation patterns in gallery "Implementation Examples" section