
Motion Patterns
Install this to drop in accessible, SSR-safe Framer Motion patterns for buttons, modals, toasts, lists, and Next.js page transitions using shared motion-foundations tokens.
Overview
Motion Patterns is an agent skill for the Build phase that supplies token-driven Framer Motion UI animation patterns for React and Next.js.
Install
npx skills add https://github.com/affaan-m/everything-claude-code --skill motion-patternsWhat is this skill?
- Copy-paste patterns for button, modal, toast, stagger, and page transitions
- Requires motion-foundations imports—no ad-hoc duration or easing numbers
- AnimatePresence-wrapped conditional renders with correct exit behavior
- Next.js App Router page transition wrapper patterns
- Scroll-reveal and layout animation via useScroll, useTransform, layout, layoutId
Adoption & trust: 1.1k installs on skills.sh; 210k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need polished enter, exit, and scroll motion in React without scattering one-off durations and broken AnimatePresence exits across the codebase.
Who is it for?
Solo builders shipping React or Next.js apps who already use or will adopt motion-foundations and want standard UI motion solved once.
Skip if: Teams building non-React stacks, purely static sites with no motion, or projects that refuse a shared motion token layer.
When should I use this skill?
Animating a button, card, modal, or toast; building list stagger; Next.js page transitions; entrance/exit on conditional content; scroll-reveal or layout expanding cards.
What do I get? / Deliverables
You get reusable, foundations-aligned component patterns—including page transitions and scroll reveals—ready to paste into your frontend.
- Accessible SSR-safe component motion snippets
- AnimatePresence conditional render wrappers
- App Router page transition wrapper
Recommended Skills
Journey fit
UI animation implementation belongs on the Build shelf because it turns design motion intent into React/Next.js component code. Patterns target frontend components (AnimatePresence, layoutId, useScroll) rather than APIs, infra, or agent tooling.
How it compares
Use as a pattern library on top of motion-foundations tokens—not as a generic CSS animation cheatsheet or a design-only brief.
Common Questions / FAQ
Who is motion-patterns for?
It is for solo and indie frontend devs on React/Next.js who want production motion patterns without inventing timing values on every screen.
When should I use motion-patterns?
Use it during Build when animating buttons, modals, toasts, staggered lists, App Router page transitions, conditional mount/unmount exits, or scroll-reveal sections.
Is motion-patterns safe to install?
It is documentation and code patterns only; review the Security Audits panel on this Prism page before trusting any third-party skill pack in your repo.
SKILL.md
READMESKILL.md - Motion Patterns
# Motion Patterns Copy-paste patterns for the most common UI animation needs. Every pattern here is built on `motion-foundations` tokens and springs. Do not define new duration or easing values here — import them. ## When to Activate - Animating a button, card, modal, or toast notification - Building list entrances with stagger - Setting up page transitions in Next.js App Router - Adding entrance or exit animations to conditional content - Implementing scroll-reveal, scroll-linked progress, or sticky story sections - Building expanding cards, accordions, or shared-element transitions ## Outputs This skill produces: - Accessible, SSR-safe animation for all standard UI components - `AnimatePresence`-wrapped conditional renders with correct exit behavior - Page transition wrapper component for Next.js App Router - Scroll-reveal and scroll-linked patterns using `useScroll` + `useTransform` - Layout animation patterns (`layout`, `layoutId`) for expanding and crossfading elements ## Principles - Every pattern imports from `motion-foundations`. No raw numbers. - Every conditional render is wrapped in `AnimatePresence` with a `key`. - Exit animations are always defined alongside enter animations — never as an afterthought. - `layout` is used only for small, isolated shifts. Large subtrees get explicit transforms. ## Rules 1. **Always wrap conditional renders in `AnimatePresence` with a `key`** on the direct child. Without a key, exit animations never fire. 2. **Always define `exit` when defining `initial` + `animate`.** An animation without an exit is incomplete. 3. **Use `mode="wait"` on page transitions.** Enter must not start until exit completes. 4. **Never use `layout` on subtrees with more than ~5 children or deeply nested DOM.** Use explicit `x`/`y` transforms instead. 5. **Stagger interval must stay between `0.05s` and `0.10s`.** Below feels mechanical; above feels sluggish. 6. **Modals must always include:** focus trap, Escape-key close, scroll lock, `role="dialog"`, `aria-modal="true"`. 7. **Scroll reveals use `viewport={{ once: true }}`.** Repeating on scroll-out is distracting, not informative. 8. **All token values are imported from `motion-foundations`.** No inline numbers. ## Decision Guidance ### Choosing the right pattern | Situation | Pattern | | ---------------------------------------- | ---------------------- | | Element appears / disappears | `AnimatePresence` | | List of items loading in sequence | Stagger variants | | Navigating between routes | Page transition wrapper| | Element changes size in place | `layout` prop | | Same element moves across page contexts | `layoutId` | | Element enters when scrolled into view | `whileInView` | | Value tied to scroll position | `useScroll` + `useTransform` | ### When to use `mode="wait"` vs `mode="sync"` | Mode | Use when | | ------- | --------------------------------------- | | `wait` | Page transitions, content swaps (one at a time) | | `sync` | Stacked notifications, list items (overlap is fine) | | `popLayout` | Items removed from a reflow list | ## Core Concepts ### AnimatePresence contract Three things must always be true: 1. `AnimatePresence` wraps the conditional 2. The direct child has a `key` 3. The child has an `exit` prop Miss any one of these and the exit animation silently fails. ### layout vs layoutId - `layout` — animates the element's own size/position change in place - `layoutId` — links two separate elements, crossfading between them across renders Use `layout="position"` on text inside an expanding container to prevent