[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M70GGEDSC004JF0JXCD8GQPQ":3,"skill-same:01M70GGEDSC004JF0JXCD8GQPQ":82},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":28,"publishedAt":49,"linkOnly":50,"markdownContent":51,"markdownBody":52,"frontMatter":53,"refName":60,"commitSha":61,"skillDirectory":62,"forksCount":63,"repositoryHtmlUrl":64,"repositoryHomepageUrl":6,"ownerHtmlUrl":65,"ownerBlogUrl":6,"ownerDescription":66,"updatedAt":67,"install":68,"resources":81},"01M70GGEDSC004JF0JXCD8GQPQ","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. Use when animating a specific UI element in React or Next.js — button, modal, toast, stagger, page transition, or scroll.","mdnaimul22\u002Fhuman-skills","mdnaimul22","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F64520358?v=4","01M70FH95MH2H796Q01TYSFZ03","Naimul","01M70FH96798CQR4YHA13F17GA",3,"MIT","https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Faffaan-m_ECC\u002Fmotion-patterns\u002FSKILL.md",[18,23],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000009","前端开发","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":26,"taxonomyTypeDesc":27},"01JBSEEDCAT000000000000032","设计师","PROFESSION","适用职业",[29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48],"motion","motion patterns","patterns","tokens","page","for","animations","ui","layout","next","springs","transition","react","when","production-ready","frontend","element","foundations","ready","Animation","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. Use when animating a specific UI element in React or Next.js — button, modal, toast, stagger, page transition, or scroll.\ntags: [motion, animation, ui-patterns]\ncategory: frontend\nauthor: jeff\nmetadata:\n  version: 1.0.0\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> {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> {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":54,"author":57,"category":44,"metadata":58,"description":7},[29,55,56],"animation","ui-patterns","jeff",{"version":59},"1.0.0","main","74715deacdc69119d739f38916f8ee4f0f979ebf","skills\u002Fstorage\u002Faffaan-m_ECC\u002Fmotion-patterns",0,"https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills","https:\u002F\u002Fgithub.com\u002Fmdnaimul22","AI Agents Workflows Automation | Specializing in Python, FastAPI, MCP Agents & Custom ERP.","2026-11-11 21:16:57",{"source":8,"skillName":5,"commands":69,"prompt":79,"zipAvailable":80},[70,73,76],{"tool":71,"command":72},"npx","npx skills add mdnaimul22\u002Fhuman-skills --skill motion-patterns",{"tool":74,"command":75},"bunx","bunx skills add mdnaimul22\u002Fhuman-skills --skill motion-patterns",{"tool":77,"command":78},"pnpm","pnpm dlx skills add mdnaimul22\u002Fhuman-skills --skill motion-patterns","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Faffaan-m_ECC\u002Fmotion-patterns\u002FSKILL.md",true,[],[83,91,99,106,113,120],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":90},"01M767791C1KRP2ZRW2Z73VZ5Q","system-lifecycle-designer","Universal architectural methodology for designing granular, atomic, and sub-atomic lifecycles and end-to-end workflows for single functionality integrations across any domain (daemons, batch jobs, request transactions, resource pools). Provides patterns for deterministic identity, pre-commit validation, differential reconciliation, sticky leasing, state machines, transactional persistence, and closed-loop feedback.","https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Fmy_skills\u002Fsystem-lifecycle-designer\u002FSKILL.md",[],[],"2026-11-12 13:55:43",{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":98},"01M748ABPN5F1FANHH6HKZQMXT","style-sampling","Make a new episode in a proven video style - Collage Explainer, Finance Explainer, Animated Science Explainer, 3D Brand Explainer, 3D True Crime - on the person's topic. Use for \"an episode of\", \"in the style of\", \"sample this style\", 「用这个风格做一集」. One video to copy is reverse-any-video.","https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Fheygen-com_hyperframes\u002Fstyle-sampling\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":98},"01M748A59V04PKW4HA0XQ81FGP","reverse-any-video","Rebuild any video file as an editable HyperFrames project - motion graphics, talking heads, live action or AI-generated footage - checked against the original frame by frame. Use to reverse, recreate, remake, replicate or copy a video, or 「复刻这个视频」「照着这个视频做一个」.","https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Fheygen-com_hyperframes\u002Freverse-any-video\u002FSKILL.md",[],[],{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":98},"01M7487T50P55CSXMWXZ0G9KRG","typescript-patterns","TypeScript patterns for strict, type-safe, maintainable code in modern TypeScript and JavaScript applications. Covers strict compiler configuration, type design, narrowing, discriminated unions, generics, async and error handling, module boundaries, dependency hygiene, and type-level testing. Use when writing or reviewing TypeScript or JavaScript code.","https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Faffaan-m_ECC\u002Ftypescript-patterns\u002FSKILL.md",[],[],{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":98},"01M7487ERZRGPC5NJ75077Y238","test-collaboration","Inventory and govern a project's test assets. Connect requirements, business rules, risks, bugs, and cross-boundary contracts to stable TEST-IDs and executable evidence in the repository's existing test registry or TESTS.md. Use for test inventory, test gap analysis, unit\u002Fintegration\u002Fcontract\u002FE2E\u002Fsmoke classification, bug-to-test regression protection, consumer\u002Fprovider contract testing, test-necessity review, and pre-delivery evidence review.","https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Faffaan-m_ECC\u002Ftest-collaboration\u002FSKILL.md",[],[],{"skillNo":121,"name":122,"nameZh":6,"description":123,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":124,"categories":125,"keywords":126,"publishedAt":98},"01M748721J3GKR2WS6K0QWFC35","story-lifecycle","Manage a file-based epic → story → sprint development loop without requiring an external project management tool. Creates and tracks epics, breaks them into user stories, assigns them to sprints, and drives implementation story by story. Use when starting a new feature initiative or when the team has no Jira\u002FLinear\u002FTaiga but needs structured delivery tracking.","https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Faffaan-m_ECC\u002Fstory-lifecycle\u002FSKILL.md",[],[]]