[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6JD9M95D0D1DPPK8WZCEM9K":3,"skill-same:01M6JD9M95D0D1DPPK8WZCEM9K":69},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":47,"commitSha":48,"skillDirectory":49,"forksCount":50,"repositoryHtmlUrl":51,"repositoryHomepageUrl":52,"ownerHtmlUrl":53,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":54,"install":55,"resources":68},"01M6JD9M95D0D1DPPK8WZCEM9K","motion-patterns",null,"Production-ready animation patterns for React \u002F Next.js — button, modal, toast, stagger, page transitions, exit animations, scroll, and layout — built on motion-foundations tokens and springs.","S3YED\u002Fappie-kit","S3YED","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F62743867?v=4","01M6JBKBRRVP6KMS0VWZ27T3R6","01M6JBKBX0KG30284PW1DBYJT1",14,"MIT","https:\u002F\u002Fgithub.com\u002FS3YED\u002Fappie-kit\u002Fblob\u002Fmaster\u002Fskills\u002Fecc\u002Fmotion-patterns\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"motion patterns","motion","patterns","animation patterns","ui-patterns","for","production-ready","springs","foundations","layout","tokens","next","frontend","exit","ready","page","Next.js","Animation","ui","react","2026-11-10 10:12:30",false,"---\nname: motion-patterns\ndescription: Production-ready animation patterns for React \u002F Next.js — button, modal, toast, stagger, page transitions, exit animations, scroll, and layout — built on motion-foundations tokens and springs.\nversion: 1.0\ntags: [motion, animation, ui-patterns]\ncategory: frontend\nauthor: jeff\n---\n\n# Motion Patterns\n\nCopy-paste patterns for the most common UI animation needs.\nEvery pattern here is built on `motion-foundations` tokens and springs.\nDo not define new duration or easing values here — import them.\n\n## When to Activate\n\n- Animating a button, card, modal, or toast notification\n- Building list entrances with stagger\n- Setting up page transitions in Next.js App Router\n- Adding entrance or exit animations to conditional content\n- Implementing scroll-reveal, scroll-linked progress, or sticky story sections\n- Building expanding cards, accordions, or shared-element transitions\n\n## Outputs\n\nThis skill produces:\n\n- Accessible, SSR-safe animation for all standard UI components\n- `AnimatePresence`-wrapped conditional renders with correct exit behavior\n- Page transition wrapper component for Next.js App Router\n- Scroll-reveal and scroll-linked patterns using `useScroll` + `useTransform`\n- Layout animation patterns (`layout`, `layoutId`) for expanding and crossfading elements\n\n## Principles\n\n- Every pattern imports from `motion-foundations`. No raw numbers.\n- Every conditional render is wrapped in `AnimatePresence` with a `key`.\n- Exit animations are always defined alongside enter animations — never as an afterthought.\n- `layout` is used only for small, isolated shifts. Large subtrees get explicit transforms.\n\n## Rules\n\n1. **Always wrap conditional renders in `AnimatePresence` with a `key`** on the direct child. Without a key, exit animations never fire.\n2. **Always define `exit` when defining `initial` + `animate`.** An animation without an exit is incomplete.\n3. **Use `mode=\"wait\"` on page transitions.** Enter must not start until exit completes.\n4. **Never use `layout` on subtrees with more than ~5 children or deeply nested DOM.** Use explicit `x`\u002F`y` transforms instead.\n5. **Stagger interval must stay between `0.05s` and `0.10s`.** Below feels mechanical; above feels sluggish.\n6. **Modals must always include:** focus trap, Escape-key close, scroll lock, `role=\"dialog\"`, `aria-modal=\"true\"`.\n7. **Scroll reveals use `viewport={{ once: true }}`.** Repeating on scroll-out is distracting, not informative.\n8. **All token values are imported from `motion-foundations`.** No inline numbers.\n\n## Decision Guidance\n\n### Choosing the right pattern\n\n| Situation | Pattern |\n| ---------------------------------------- | ---------------------- |\n| Element appears \u002F disappears             | `AnimatePresence`      |\n| List of items loading in sequence        | Stagger variants       |\n| Navigating between routes                | Page transition wrapper|\n| Element changes size in place            | `layout` prop          |\n| Same element moves across page contexts  | `layoutId`             |\n| Element enters when scrolled into view   | `whileInView`          |\n| Value tied to scroll position            | `useScroll` + `useTransform` |\n\n### When to use `mode=\"wait\"` vs `mode=\"sync\"`\n\n| Mode | Use when |\n| ------- | --------------------------------------- |\n| `wait` | Page transitions, content swaps (one at a time) |\n| `sync` | Stacked notifications, list items (overlap is fine) |\n| `popLayout` | Items removed from a reflow list |\n\n## Core Concepts\n\n### AnimatePresence contract\n\nThree things must always be true:\n\n1. `AnimatePresence` wraps the conditional\n2. The direct child has a `key`\n3. The child has an `exit` prop\n\nMiss any one of these and the exit animation silently fails.\n\n### layout vs layoutId\n\n- `layout` — animates the element's own size\u002Fposition change in place\n- `layoutId` — links two separate elements, crossfading between them across renders\n\nUse `layout=\"position\"` on text inside an expanding container to prevent text reflow from animating.\n\n## Code Examples\n\n### Button feedback\n\n```tsx\n\"use client\"\nimport { motion } from \"motion\u002Freact\"\nimport { springs, motionTokens } from \"@\u002Flib\u002Fmotion-tokens\"\n\n\u003Cmotion.button\n  whileHover={{ scale: motionTokens.scale.pop }}\n  whileTap={{ scale: motionTokens.scale.press }}\n  transition={springs.snappy}\n\u002F>\n```\n\n### Stagger list\n\n```tsx\n\"use client\"\nimport { motion } from \"motion\u002Freact\"\nimport { motionTokens, springs } from \"@\u002Flib\u002Fmotion-tokens\"\n\nconst container = {\n  hidden: {},\n  visible: {\n    transition: {\n      staggerChildren: 0.08,   \u002F\u002F within the 0.05–0.10 rule\n      delayChildren: 0.1,\n    },\n  },\n}\n\nconst item = {\n  hidden:  { opacity: 0, y: motionTokens.distance.md },\n  visible: { opacity: 1, y: 0, transition: springs.gentle },\n}\n\n\u003Cmotion.ul variants={container} initial=\"hidden\" animate=\"visible\">\n  {items.map((i) => (\n    \u003Cmotion.li key={i.id} variants={item} \u002F>\n  ))}\n\u003C\u002Fmotion.ul>\n```\n\n### Modal\n\n```tsx\n\"use client\"\nimport { motion, AnimatePresence } from \"motion\u002Freact\"\nimport { motionTokens, springs } from \"@\u002Flib\u002Fmotion-tokens\"\n\n\u002F\u002F Wrap at the call site:\n\u002F\u002F \u003CAnimatePresence>{isOpen && \u003CModal key=\"modal\" \u002F>}\u003C\u002FAnimatePresence>\n\nexport function Modal({ onClose }: { onClose: () => void }) {\n  return (\n    \u003C>\n      {\u002F* Overlay *\u002F}\n      \u003Cmotion.div\n        className=\"fixed inset-0 bg-black\u002F50\"\n        initial={{ opacity: 0 }}\n        animate={{ opacity: 1 }}\n        exit={{ opacity: 0 }}\n        onClick={onClose}\n      \u002F>\n\n      {\u002F* Panel — accessibility requirements: focus trap, Escape close,\n          scroll lock, role=\"dialog\", aria-modal=\"true\" *\u002F}\n      \u003Cmotion.div\n        role=\"dialog\"\n        aria-modal=\"true\"\n        className=\"fixed inset-x-4 top-1\u002F2 -translate-y-1\u002F2 rounded-xl bg-white p-6\"\n        initial={{\n          opacity: 0,\n          scale: motionTokens.scale.press,\n          y: motionTokens.distance.sm,\n        }}\n        animate={{ opacity: 1, scale: 1, y: 0 }}\n        exit={{\n          opacity: 0,\n          scale: motionTokens.scale.press,\n          y: motionTokens.distance.sm,\n        }}\n        transition={springs.gentle}\n      \u002F>\n    \u003C\u002F>\n  )\n}\n```\n\n### Toast stack\n\n```tsx\n\"use client\"\nimport { motion, AnimatePresence } from \"motion\u002Freact\"\nimport { motionTokens, springs } from \"@\u002Flib\u002Fmotion-tokens\"\n\n\u003CAnimatePresence mode=\"sync\">\n  {toasts.map((t) => (\n    \u003Cmotion.div\n      key={t.id}\n      layout\n      initial={{\n        opacity: 0,\n        x: motionTokens.distance.xl,\n        scale: motionTokens.scale.subtle,\n      }}\n      animate={{ opacity: 1, x: 0, scale: 1 }}\n      exit={{\n        opacity: 0,\n        x: motionTokens.distance.xl,\n        scale: motionTokens.scale.subtle,\n      }}\n      transition={springs.snappy}\n    \u002F>\n  ))}\n\u003C\u002FAnimatePresence>\n```\n\n### Page transition (Next.js App Router)\n\n```tsx\n\u002F\u002F components\u002Fpage-transition.tsx\n\"use client\"\nimport { motion, AnimatePresence } from \"motion\u002Freact\"\nimport { usePathname } from \"next\u002Fnavigation\"\nimport { motionTokens } from \"@\u002Flib\u002Fmotion-tokens\"\n\nconst variants = {\n  initial: { opacity: 0, y: motionTokens.distance.sm },\n  enter:   { opacity: 1, y: 0 },\n  exit:    { opacity: 0, y: -motionTokens.distance.sm },\n}\n\nexport function PageTransition({ children }: { children: React.ReactNode }) {\n  const pathname = usePathname()\n  return (\n    \u003CAnimatePresence mode=\"wait\">\n      \u003Cmotion.div\n        key={pathname}\n        variants={variants}\n        initial=\"initial\"\n        animate=\"enter\"\n        exit=\"exit\"\n        transition={{\n          duration: motionTokens.duration.normal,\n          ease: motionTokens.easing.smooth,\n        }}\n      >\n        {children}\n      \u003C\u002Fmotion.div>\n    \u003C\u002FAnimatePresence>\n  )\n}\n```\n\n### Scroll reveal\n\n```tsx\n\"use client\"\nimport { motion } from \"motion\u002Freact\"\nimport { motionTokens, springs } from \"@\u002Flib\u002Fmotion-tokens\"\n\n\u003Cmotion.div\n  initial={{ opacity: 0, y: motionTokens.distance.lg }}\n  whileInView={{ opacity: 1, y: 0 }}\n  viewport={{ once: true, margin: \"-80px\" }}   \u002F\u002F once: true — rule 7\n  transition={{ duration: motionTokens.duration.slow, ease: motionTokens.easing.smooth }}\n\u002F>\n```\n\n### Scroll progress bar\n\n```tsx\n\"use client\"\nimport { motion, useScroll } from \"motion\u002Freact\"\n\nexport function ScrollProgress() {\n  const { scrollYProgress } = useScroll()\n  return (\n    \u003Cmotion.div\n      className=\"fixed top-0 left-0 h-1 bg-indigo-500 origin-left w-full\"\n      style={{ scaleX: scrollYProgress }}\n    \u002F>\n  )\n}\n```\n\n### Expanding card\n\n```tsx\n\"use client\"\nimport { useState } from \"react\"\nimport { motion, AnimatePresence } from \"motion\u002Freact\"\nimport { springs, motionTokens } from \"@\u002Flib\u002Fmotion-tokens\"\n\nexport function ExpandingCard({ title, body }: { title: string; body: string }) {\n  const [expanded, setExpanded] = useState(false)\n\n  return (\n    \u003Cmotion.div layout onClick={() => setExpanded(!expanded)} className=\"cursor-pointer\">\n      {\u002F* layout=\"position\" prevents text reflow from animating *\u002F}\n      \u003Cmotion.h2 layout=\"position\" className=\"font-semibold\">\n        {title}\n      \u003C\u002Fmotion.h2>\n\n      \u003CAnimatePresence>\n        {expanded && (\n          \u003Cmotion.p\n            key=\"body\"\n            initial={{ opacity: 0 }}\n            animate={{ opacity: 1 }}\n            exit={{ opacity: 0 }}\n            transition={{ duration: motionTokens.duration.fast }}\n          >\n            {body}\n          \u003C\u002Fmotion.p>\n        )}\n      \u003C\u002FAnimatePresence>\n    \u003C\u002Fmotion.div>\n  )\n}\n```\n\n### Shared-element crossfade\n\n```tsx\n\u002F\u002F Source context\n\u003Cmotion.img layoutId=\"hero-image\" src={src} className=\"w-16 h-16 rounded\" \u002F>\n\n\u002F\u002F Destination context (same layoutId — motion handles the transition)\n\u003Cmotion.img layoutId=\"hero-image\" src={src} className=\"w-full rounded-xl\" \u002F>\n```\n\n### Accordion\n\n```tsx\n\u003Cmotion.div\n  initial={false}\n  animate={{ opacity: open ? 1 : 0, scaleY: open ? 1 : 0 }}\n  style={{ transformOrigin: \"top\", overflow: \"hidden\" }}\n  transition={{\n    duration: motionTokens.duration.normal,\n    ease: motionTokens.easing.smooth,\n  }}\n>\n  {children}\n\u003C\u002Fmotion.div>\n```\n\n## End-to-End Example\n\nA staggered list that enters on mount, handles conditional presence, and\nrespects reduced motion — combining tokens, springs, AnimatePresence, and\nthe accessibility hook from `motion-foundations`:\n\n```tsx\n\"use client\"\nimport { useState } from \"react\"\nimport { motion, AnimatePresence } from \"motion\u002Freact\"\nimport { motionTokens, springs } from \"@\u002Flib\u002Fmotion-tokens\"\nimport { useSafeMotion } from \"@\u002Fhooks\u002Fuse-reduced-motion\"\n\nconst containerVariants = {\n  hidden: {},\n  visible: {\n    transition: { staggerChildren: 0.08, delayChildren: 0.1 },\n  },\n}\n\nfunction ListItem({ label, onRemove }: { label: string; onRemove: () => void }) {\n  const safe = useSafeMotion(motionTokens.distance.sm)\n  return (\n    \u003Cmotion.li\n      variants={{\n        hidden:  safe.initial,\n        visible: safe.animate,\n      }}\n      exit={safe.exit}\n      transition={springs.gentle}\n      className=\"flex items-center justify-between p-3 rounded-lg bg-white shadow-sm\"\n    >\n      \u003Cspan>{label}\u003C\u002Fspan>\n      \u003Cbutton onClick={onRemove}>Remove\u003C\u002Fbutton>\n    \u003C\u002Fmotion.li>\n  )\n}\n\nexport function AnimatedList({ items, onRemove }: {\n  items: { id: string; label: string }[]\n  onRemove: (id: string) => void\n}) {\n  return (\n    \u003Cmotion.ul\n      variants={containerVariants}\n      initial=\"hidden\"\n      animate=\"visible\"\n      className=\"space-y-2\"\n    >\n      \u003CAnimatePresence mode=\"popLayout\">\n        {items.map((item) => (\n          \u003CListItem\n            key={item.id}\n            label={item.label}\n            onRemove={() => onRemove(item.id)}\n          \u002F>\n        ))}\n      \u003C\u002FAnimatePresence>\n    \u003C\u002Fmotion.ul>\n  )\n}\n```\n\n## Constraints \u002F Non-Goals\n\nThis skill does **not** cover:\n\n- Token and spring definitions → see `motion-foundations`\n- Drag interactions, swipe gestures, reorderable lists → see `motion-advanced`\n- Text animations (word\u002Fcharacter reveal, counters) → see `motion-advanced`\n- SVG path drawing or morphing → see `motion-advanced`\n- Custom animation hooks → see `motion-advanced`\n- CSS-only transitions not using `motion\u002Freact`\n\n## Anti-Patterns\n\n| Anti-pattern | Rule violated | Fix |\n| -------------------------------------------- | ------- | ------------------------------------------ |\n| `AnimatePresence` child missing `key` | Rule 1 | Add stable `key` to the direct child |\n| `initial` + `animate` without `exit` | Rule 2 | Always define all three together |\n| Page transition without `mode=\"wait\"` | Rule 3 | Add `mode=\"wait\"` to `AnimatePresence` |\n| `layout` on a 50-item list | Rule 4 | Use `mode=\"popLayout\"` or explicit transforms |\n| `staggerChildren: 0.2` on a 10-item list | Rule 5 | Cap at `0.08–0.10` |\n| Modal without focus trap | Rule 6 | Add `focus-trap-react` or Radix Dialog |\n| `whileInView` without `viewport={{ once: true }}` | Rule 7 | Repeating entrances distract, not inform |\n| `transition={{ duration: 0.3 }}` inline | Rule 8 | Use `motionTokens.duration.normal` |\n\n## Related Skills\n\n- **`motion-foundations`** — defines all tokens, springs, the `useSafeMotion` hook, and SSR guards that every pattern here imports. Must be set up first.\n- **`motion-advanced`** — extends these patterns with drag, gestures, SVG, text, custom hooks, and imperative sequencing. Does not redefine any patterns from this skill.\n","# Motion Patterns\n\nCopy-paste patterns for the most common UI animation needs.\nEvery pattern here is built on `motion-foundations` tokens and springs.\nDo not define new duration or easing values here — import them.\n\n## When to Activate\n\n- Animating a button, card, modal, or toast notification\n- Building list entrances with stagger\n- Setting up page transitions in Next.js App Router\n- Adding entrance or exit animations to conditional content\n- Implementing scroll-reveal, scroll-linked progress, or sticky story sections\n- Building expanding cards, accordions, or shared-element transitions\n\n## Outputs\n\nThis skill produces:\n\n- Accessible, SSR-safe animation for all standard UI components\n- `AnimatePresence`-wrapped conditional renders with correct exit behavior\n- Page transition wrapper component for Next.js App Router\n- Scroll-reveal and scroll-linked patterns using `useScroll` + `useTransform`\n- Layout animation patterns (`layout`, `layoutId`) for expanding and crossfading elements\n\n## Principles\n\n- Every pattern imports from `motion-foundations`. No raw numbers.\n- Every conditional render is wrapped in `AnimatePresence` with a `key`.\n- Exit animations are always defined alongside enter animations — never as an afterthought.\n- `layout` is used only for small, isolated shifts. Large subtrees get explicit transforms.\n\n## Rules\n\n1. **Always wrap conditional renders in `AnimatePresence` with a `key`** on the direct child. Without a key, exit animations never fire.\n2. **Always define `exit` when defining `initial` + `animate`.** An animation without an exit is incomplete.\n3. **Use `mode=\"wait\"` on page transitions.** Enter must not start until exit completes.\n4. **Never use `layout` on subtrees with more than ~5 children or deeply nested DOM.** Use explicit `x`\u002F`y` transforms instead.\n5. **Stagger interval must stay between `0.05s` and `0.10s`.** Below feels mechanical; above feels sluggish.\n6. **Modals must always include:** focus trap, Escape-key close, scroll lock, `role=\"dialog\"`, `aria-modal=\"true\"`.\n7. **Scroll reveals use `viewport={{ once: true }}`.** Repeating on scroll-out is distracting, not informative.\n8. **All token values are imported from `motion-foundations`.** No inline numbers.\n\n## Decision Guidance\n\n### Choosing the right pattern\n\n| Situation | Pattern |\n| ---------------------------------------- | ---------------------- |\n| Element appears \u002F disappears             | `AnimatePresence`      |\n| List of items loading in sequence        | Stagger variants       |\n| Navigating between routes                | Page transition wrapper|\n| Element changes size in place            | `layout` prop          |\n| Same element moves across page contexts  | `layoutId`             |\n| Element enters when scrolled into view   | `whileInView`          |\n| Value tied to scroll position            | `useScroll` + `useTransform` |\n\n### When to use `mode=\"wait\"` vs `mode=\"sync\"`\n\n| Mode | Use when |\n| ------- | --------------------------------------- |\n| `wait` | Page transitions, content swaps (one at a time) |\n| `sync` | Stacked notifications, list items (overlap is fine) |\n| `popLayout` | Items removed from a reflow list |\n\n## Core Concepts\n\n### AnimatePresence contract\n\nThree things must always be true:\n\n1. `AnimatePresence` wraps the conditional\n2. The direct child has a `key`\n3. The child has an `exit` prop\n\nMiss any one of these and the exit animation silently fails.\n\n### layout vs layoutId\n\n- `layout` — animates the element's own size\u002Fposition change in place\n- `layoutId` — links two separate elements, crossfading between them across renders\n\nUse `layout=\"position\"` on text inside an expanding container to prevent text reflow from animating.\n\n## Code Examples\n\n### Button feedback\n\n```tsx\n\"use client\"\nimport { motion } from \"motion\u002Freact\"\nimport { springs, motionTokens } from \"@\u002Flib\u002Fmotion-tokens\"\n\n\u003Cmotion.button\n  whileHover={{ scale: motionTokens.scale.pop }}\n  whileTap={{ scale: motionTokens.scale.press }}\n  transition={springs.snappy}\n\u002F>\n```\n\n### Stagger list\n\n```tsx\n\"use client\"\nimport { motion } from \"motion\u002Freact\"\nimport { motionTokens, springs } from \"@\u002Flib\u002Fmotion-tokens\"\n\nconst container = {\n  hidden: {},\n  visible: {\n    transition: {\n      staggerChildren: 0.08,   \u002F\u002F within the 0.05–0.10 rule\n      delayChildren: 0.1,\n    },\n  },\n}\n\nconst item = {\n  hidden:  { opacity: 0, y: motionTokens.distance.md },\n  visible: { opacity: 1, y: 0, transition: springs.gentle },\n}\n\n\u003Cmotion.ul variants={container} initial=\"hidden\" animate=\"visible\">\n  {items.map((i) => (\n    \u003Cmotion.li key={i.id} variants={item} \u002F>\n  ))}\n\u003C\u002Fmotion.ul>\n```\n\n### Modal\n\n```tsx\n\"use client\"\nimport { motion, AnimatePresence } from \"motion\u002Freact\"\nimport { motionTokens, springs } from \"@\u002Flib\u002Fmotion-tokens\"\n\n\u002F\u002F Wrap at the call site:\n\u002F\u002F \u003CAnimatePresence>{isOpen && \u003CModal key=\"modal\" \u002F>}\u003C\u002FAnimatePresence>\n\nexport function Modal({ onClose }: { onClose: () => void }) {\n  return (\n    \u003C>\n      {\u002F* Overlay *\u002F}\n      \u003Cmotion.div\n        className=\"fixed inset-0 bg-black\u002F50\"\n        initial={{ opacity: 0 }}\n        animate={{ opacity: 1 }}\n        exit={{ opacity: 0 }}\n        onClick={onClose}\n      \u002F>\n\n      {\u002F* Panel — accessibility requirements: focus trap, Escape close,\n          scroll lock, role=\"dialog\", aria-modal=\"true\" *\u002F}\n      \u003Cmotion.div\n        role=\"dialog\"\n        aria-modal=\"true\"\n        className=\"fixed inset-x-4 top-1\u002F2 -translate-y-1\u002F2 rounded-xl bg-white p-6\"\n        initial={{\n          opacity: 0,\n          scale: motionTokens.scale.press,\n          y: motionTokens.distance.sm,\n        }}\n        animate={{ opacity: 1, scale: 1, y: 0 }}\n        exit={{\n          opacity: 0,\n          scale: motionTokens.scale.press,\n          y: motionTokens.distance.sm,\n        }}\n        transition={springs.gentle}\n      \u002F>\n    \u003C\u002F>\n  )\n}\n```\n\n### Toast stack\n\n```tsx\n\"use client\"\nimport { motion, AnimatePresence } from \"motion\u002Freact\"\nimport { motionTokens, springs } from \"@\u002Flib\u002Fmotion-tokens\"\n\n\u003CAnimatePresence mode=\"sync\">\n  {toasts.map((t) => (\n    \u003Cmotion.div\n      key={t.id}\n      layout\n      initial={{\n        opacity: 0,\n        x: motionTokens.distance.xl,\n        scale: motionTokens.scale.subtle,\n      }}\n      animate={{ opacity: 1, x: 0, scale: 1 }}\n      exit={{\n        opacity: 0,\n        x: motionTokens.distance.xl,\n        scale: motionTokens.scale.subtle,\n      }}\n      transition={springs.snappy}\n    \u002F>\n  ))}\n\u003C\u002FAnimatePresence>\n```\n\n### Page transition (Next.js App Router)\n\n```tsx\n\u002F\u002F components\u002Fpage-transition.tsx\n\"use client\"\nimport { motion, AnimatePresence } from \"motion\u002Freact\"\nimport { usePathname } from \"next\u002Fnavigation\"\nimport { motionTokens } from \"@\u002Flib\u002Fmotion-tokens\"\n\nconst variants = {\n  initial: { opacity: 0, y: motionTokens.distance.sm },\n  enter:   { opacity: 1, y: 0 },\n  exit:    { opacity: 0, y: -motionTokens.distance.sm },\n}\n\nexport function PageTransition({ children }: { children: React.ReactNode }) {\n  const pathname = usePathname()\n  return (\n    \u003CAnimatePresence mode=\"wait\">\n      \u003Cmotion.div\n        key={pathname}\n        variants={variants}\n        initial=\"initial\"\n        animate=\"enter\"\n        exit=\"exit\"\n        transition={{\n          duration: motionTokens.duration.normal,\n          ease: motionTokens.easing.smooth,\n        }}\n      >\n        {children}\n      \u003C\u002Fmotion.div>\n    \u003C\u002FAnimatePresence>\n  )\n}\n```\n\n### Scroll reveal\n\n```tsx\n\"use client\"\nimport { motion } from \"motion\u002Freact\"\nimport { motionTokens, springs } from \"@\u002Flib\u002Fmotion-tokens\"\n\n\u003Cmotion.div\n  initial={{ opacity: 0, y: motionTokens.distance.lg }}\n  whileInView={{ opacity: 1, y: 0 }}\n  viewport={{ once: true, margin: \"-80px\" }}   \u002F\u002F once: true — rule 7\n  transition={{ duration: motionTokens.duration.slow, ease: motionTokens.easing.smooth }}\n\u002F>\n```\n\n### Scroll progress bar\n\n```tsx\n\"use client\"\nimport { motion, useScroll } from \"motion\u002Freact\"\n\nexport function ScrollProgress() {\n  const { scrollYProgress } = useScroll()\n  return (\n    \u003Cmotion.div\n      className=\"fixed top-0 left-0 h-1 bg-indigo-500 origin-left w-full\"\n      style={{ scaleX: scrollYProgress }}\n    \u002F>\n  )\n}\n```\n\n### Expanding card\n\n```tsx\n\"use client\"\nimport { useState } from \"react\"\nimport { motion, AnimatePresence } from \"motion\u002Freact\"\nimport { springs, motionTokens } from \"@\u002Flib\u002Fmotion-tokens\"\n\nexport function ExpandingCard({ title, body }: { title: string; body: string }) {\n  const [expanded, setExpanded] = useState(false)\n\n  return (\n    \u003Cmotion.div layout onClick={() => setExpanded(!expanded)} className=\"cursor-pointer\">\n      {\u002F* layout=\"position\" prevents text reflow from animating *\u002F}\n      \u003Cmotion.h2 layout=\"position\" className=\"font-semibold\">\n        {title}\n      \u003C\u002Fmotion.h2>\n\n      \u003CAnimatePresence>\n        {expanded && (\n          \u003Cmotion.p\n            key=\"body\"\n            initial={{ opacity: 0 }}\n            animate={{ opacity: 1 }}\n            exit={{ opacity: 0 }}\n            transition={{ duration: motionTokens.duration.fast }}\n          >\n            {body}\n          \u003C\u002Fmotion.p>\n        )}\n      \u003C\u002FAnimatePresence>\n    \u003C\u002Fmotion.div>\n  )\n}\n```\n\n### Shared-element crossfade\n\n```tsx\n\u002F\u002F Source context\n\u003Cmotion.img layoutId=\"hero-image\" src={src} className=\"w-16 h-16 rounded\" \u002F>\n\n\u002F\u002F Destination context (same layoutId — motion handles the transition)\n\u003Cmotion.img layoutId=\"hero-image\" src={src} className=\"w-full rounded-xl\" \u002F>\n```\n\n### Accordion\n\n```tsx\n\u003Cmotion.div\n  initial={false}\n  animate={{ opacity: open ? 1 : 0, scaleY: open ? 1 : 0 }}\n  style={{ transformOrigin: \"top\", overflow: \"hidden\" }}\n  transition={{\n    duration: motionTokens.duration.normal,\n    ease: motionTokens.easing.smooth,\n  }}\n>\n  {children}\n\u003C\u002Fmotion.div>\n```\n\n## End-to-End Example\n\nA staggered list that enters on mount, handles conditional presence, and\nrespects reduced motion — combining tokens, springs, AnimatePresence, and\nthe accessibility hook from `motion-foundations`:\n\n```tsx\n\"use client\"\nimport { useState } from \"react\"\nimport { motion, AnimatePresence } from \"motion\u002Freact\"\nimport { motionTokens, springs } from \"@\u002Flib\u002Fmotion-tokens\"\nimport { useSafeMotion } from \"@\u002Fhooks\u002Fuse-reduced-motion\"\n\nconst containerVariants = {\n  hidden: {},\n  visible: {\n    transition: { staggerChildren: 0.08, delayChildren: 0.1 },\n  },\n}\n\nfunction ListItem({ label, onRemove }: { label: string; onRemove: () => void }) {\n  const safe = useSafeMotion(motionTokens.distance.sm)\n  return (\n    \u003Cmotion.li\n      variants={{\n        hidden:  safe.initial,\n        visible: safe.animate,\n      }}\n      exit={safe.exit}\n      transition={springs.gentle}\n      className=\"flex items-center justify-between p-3 rounded-lg bg-white shadow-sm\"\n    >\n      \u003Cspan>{label}\u003C\u002Fspan>\n      \u003Cbutton onClick={onRemove}>Remove\u003C\u002Fbutton>\n    \u003C\u002Fmotion.li>\n  )\n}\n\nexport function AnimatedList({ items, onRemove }: {\n  items: { id: string; label: string }[]\n  onRemove: (id: string) => void\n}) {\n  return (\n    \u003Cmotion.ul\n      variants={containerVariants}\n      initial=\"hidden\"\n      animate=\"visible\"\n      className=\"space-y-2\"\n    >\n      \u003CAnimatePresence mode=\"popLayout\">\n        {items.map((item) => (\n          \u003CListItem\n            key={item.id}\n            label={item.label}\n            onRemove={() => onRemove(item.id)}\n          \u002F>\n        ))}\n      \u003C\u002FAnimatePresence>\n    \u003C\u002Fmotion.ul>\n  )\n}\n```\n\n## Constraints \u002F Non-Goals\n\nThis skill does **not** cover:\n\n- Token and spring definitions → see `motion-foundations`\n- Drag interactions, swipe gestures, reorderable lists → see `motion-advanced`\n- Text animations (word\u002Fcharacter reveal, counters) → see `motion-advanced`\n- SVG path drawing or morphing → see `motion-advanced`\n- Custom animation hooks → see `motion-advanced`\n- CSS-only transitions not using `motion\u002Freact`\n\n## Anti-Patterns\n\n| Anti-pattern | Rule violated | Fix |\n| -------------------------------------------- | ------- | ------------------------------------------ |\n| `AnimatePresence` child missing `key` | Rule 1 | Add stable `key` to the direct child |\n| `initial` + `animate` without `exit` | Rule 2 | Always define all three together |\n| Page transition without `mode=\"wait\"` | Rule 3 | Add `mode=\"wait\"` to `AnimatePresence` |\n| `layout` on a 50-item list | Rule 4 | Use `mode=\"popLayout\"` or explicit transforms |\n| `staggerChildren: 0.2` on a 10-item list | Rule 5 | Cap at `0.08–0.10` |\n| Modal without focus trap | Rule 6 | Add `focus-trap-react` or Radix Dialog |\n| `whileInView` without `viewport={{ once: true }}` | Rule 7 | Repeating entrances distract, not inform |\n| `transition={{ duration: 0.3 }}` inline | Rule 8 | Use `motionTokens.duration.normal` |\n\n## Related Skills\n\n- **`motion-foundations`** — defines all tokens, springs, the `useSafeMotion` hook, and SSR guards that every pattern here imports. Must be set up first.\n- **`motion-advanced`** — extends these patterns with drag, gestures, SVG, text, custom hooks, and imperative sequencing. Does not redefine any patterns from this skill.\n",{"name":5,"tags":43,"author":45,"version":46,"category":30,"description":7},[19,44,22],"animation","jeff",1,"master","8ec37df6d71fb664ea19d32c079e7d3ff931a8e0","skills\u002Fecc\u002Fmotion-patterns",3,"https:\u002F\u002Fgithub.com\u002FS3YED\u002Fappie-kit","https:\u002F\u002Fweblyfe.ai","https:\u002F\u002Fgithub.com\u002FS3YED","2026-08-27 01:54:02",{"source":8,"skillName":5,"commands":56,"prompt":66,"zipAvailable":67},[57,60,63],{"tool":58,"command":59},"npx","npx skills add S3YED\u002Fappie-kit --skill motion-patterns",{"tool":61,"command":62},"bunx","bunx skills add S3YED\u002Fappie-kit --skill motion-patterns",{"tool":64,"command":65},"pnpm","pnpm dlx skills add S3YED\u002Fappie-kit --skill motion-patterns","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FS3YED\u002Fappie-kit\u002Fblob\u002Fmaster\u002Fskills\u002Fecc\u002Fmotion-patterns\u002FSKILL.md",true,[],[70,95,121,145,172,195],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":38},"01M6JFD4M6N4DSGC7TXEJ5R3J2","ai-music","AI music generation and audio tools: HeartMuLa lyrics-to-music generation, songwriting craft (+ Suno prompts), and audio spectrogram\u002Ffeature visualization.","https:\u002F\u002Fgithub.com\u002FS3YED\u002Fappie-kit\u002Fblob\u002Fmaster\u002Fskills\u002Fwethlete\u002Fai-music\u002FSKILL.md",[],[77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94],"music","ai music","humanizer","visualization","Tools","Audio","hermes","hermes agent","songwriting","suno","lyrics","prompts","heartmula","craft","generation","feature","ai music generation","music generation",{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":38},"01M6JFCZE4XNFQFMNZDHKHT5V5","agentic-webdesign-design-system-ingestion","Use v0 Design Systems 2.0, Bolt Design System Agents, or Lovable to generate production UI from a client's real design system components — not generic Tailwind. Use when building a client website where brand consistency matters.","https:\u002F\u002Fgithub.com\u002FS3YED\u002Fappie-kit\u002Fblob\u002Fmaster\u002Fskills\u002Fweb-design\u002Fagentic-webdesign-design-system-ingestion\u002FSKILL.md",[],[102,103,104,105,106,107,108,109,110,111,112,36,113,114,115,116,117,118,119,120],"design","agentic","design system","system","ingestion","webdesign","agentic webdesign design system ingestion","components","generate","design systems","website","Tailwind","bolt","lovable","v0","design-system","wed","design system components","appie",{"skillNo":122,"name":123,"nameZh":6,"description":124,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":125,"categories":126,"keywords":127,"publishedAt":38},"01M6JFCVPX3913CFAS6QQJ33ZB","agentic-webdesign-agent-elements","Use 21st.dev Agent Elements — 25 shadcn\u002Fui components purpose-built for AI agent UIs. Tool cards (Bash, Edit, Search, Plan, Subagent, MCP), chat, input, streaming. Open source, shadcn-registry install, no runtime lock-in.","https:\u002F\u002Fgithub.com\u002FS3YED\u002Fappie-kit\u002Fblob\u002Fmaster\u002Fskills\u002Fweb-design\u002Fagentic-webdesign-agent-elements\u002FSKILL.md",[],[103,128,107,129,130,131,109,132,133,134,135,136,137,138,139,140,141,142,143,144],"elements","agentic webdesign agent elements","MCP","ai agent","registry","search","streaming","open source","open","Bash","plan","subagent","edit","install","input","lock","source",{"skillNo":146,"name":147,"nameZh":6,"description":148,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":149,"categories":150,"keywords":151,"publishedAt":38},"01M6JFCQC7H65M9QJ6TRE71BS1","vercel-deployment","Deploy static sites and frontends to Vercel — handles both CLI and REST API paths, including the CLI token sanitization workaround.","https:\u002F\u002Fgithub.com\u002FS3YED\u002Fappie-kit\u002Fblob\u002Fmaster\u002Fskills\u002Fsoftware-development\u002Fvercel-deployment\u002FSKILL.md",[],[152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171],"deployment","vercel deployment","vercel","macos","cli","linux","windows","deploy","vercel deploy","REST","api","site","deploy to vercel","token","rest api","host","sites","paths","sanitization","static site",{"skillNo":173,"name":174,"nameZh":6,"description":175,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":176,"categories":177,"keywords":178,"publishedAt":38},"01M6JFCM4SMTXBM5A01BK2YQG1","software-quality-workflows","Umbrella workflow for TDD, debugging, code simplification, spikes, pre-commit review, and debugger-assisted investigation.","https:\u002F\u002Fgithub.com\u002FS3YED\u002Fappie-kit\u002Fblob\u002Fmaster\u002Fskills\u002Fsoftware-development\u002Fsoftware-quality-workflows\u002FSKILL.md",[],[179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,23],"workflows","quality","software","software quality workflows","review","tdd","workflow","commit","debugging","code","debugger","pre-commit","investigation","code simplification","user","simplification",{"skillNo":196,"name":197,"nameZh":6,"description":198,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":199,"categories":200,"keywords":201,"publishedAt":38},"01M6JFCGD0M6CEATY01W7YN6DB","react-component-refactoring","Safely refactor large React components into smaller, maintainable pieces using proven patterns","https:\u002F\u002Fgithub.com\u002FS3YED\u002Fappie-kit\u002Fblob\u002Fmaster\u002Fskills\u002Fsoftware-development\u002Freact-component-refactoring\u002FSKILL.md",[],[37,202,203,204,205,206,30,207,155,208,209,109,210,158,211,188,212,213,20,214],"component","refactoring","component refactoring","react component","react component refactoring","writing","safe","typescript","react components","modular","refactor","simplify","test-driven-development"]