[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7FASN9SP7TJZGJKXCNVFP55":3,"skill-same:01M7FASN9SP7TJZGJKXCNVFP55":54},{"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":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":32,"commitSha":33,"skillDirectory":34,"forksCount":35,"repositoryHtmlUrl":36,"repositoryHomepageUrl":6,"ownerHtmlUrl":37,"ownerBlogUrl":6,"ownerDescription":38,"updatedAt":39,"install":40,"resources":53},"01M7FASN9SP7TJZGJKXCNVFP55","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.","lza6\u002FArmor-piercing-system-prompts","lza6","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F128880206?v=4","01M7EB3K7WPX5T28EJ2NVHE6EG","Chinese-tingfeng","01M7EB3K97E1KQ16QWKJMFNGX8",11,"MIT","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F06-前端与设计\u002Fmotion-patterns\u002FSKILL.md",[],[],"2026-11-16 10:05:34",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":24,"author":28,"category":29,"metadata":30,"description":7},[25,26,27],"motion","animation","ui-patterns","jeff","frontend",{"version":31},"1.0.0","main","d69096e239f2a89aabc2cd078c47664a9d3b1e11","06-前端与设计\u002Fmotion-patterns",3,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts","https:\u002F\u002Fgithub.com\u002Flza6","个人vx：Tf00798\r\n个人✈：@TFGY999","2026-10-08 14:29:22",{"source":8,"skillName":5,"commands":41,"prompt":51,"zipAvailable":52},[42,45,48],{"tool":43,"command":44},"npx","npx skills add lza6\u002FArmor-piercing-system-prompts --skill motion-patterns",{"tool":46,"command":47},"bunx","bunx skills add lza6\u002FArmor-piercing-system-prompts --skill motion-patterns",{"tool":49,"command":50},"pnpm","pnpm dlx skills add lza6\u002FArmor-piercing-system-prompts --skill motion-patterns","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F06-前端与设计\u002Fmotion-patterns\u002FSKILL.md",true,[],[55,62,67,74,81,88],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":19},"01M7FFG485KY83TD6HSC4YPCMC","obsidian-clipper-template-creator","Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobsidian-clipper-template-creator\u002FSKILL.md",[],[],{"skillNo":63,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":19},"01M7FFG0T6AZ0STEJPSB3CX84K","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobsidian-clipper-template-creator-antigravity-awesome-skills-main\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":19},"01M7FFFY0QEM14SKWPDYGMXM2P","python-api","Programmatic Object-Detection-Metrics API guidance for BoundingBox, BoundingBoxes, Evaluator, enums, coordinate conversion, AP\u002FmAP semantics, and source-style import diagnostics.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002Fsub-skills\u002Fpython-api\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":19},"01M7FFFVZQZ2GJ0C0TGP7JHD20","file-evaluation","Folder-based PASCAL VOC AP\u002FmAP evaluation from ground-truth and detection text files.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002Fsub-skills\u002Ffile-evaluation\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M7FFFSFNYSE77SJ6PE1CK2DA","object-detection-metrics","Guides legacy Object-Detection-Metrics PASCAL VOC AP\u002FmAP evaluation from detection text folders and direct Python API classes.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":19},"01M7FFFP0GCK1RVXBCPQ8APBMT","nx-workspace-patterns","Configure and optimize Nx monorepo workspaces. Use when setting up Nx, configuring project boundaries, optimizing build caching, or implementing affected commands.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fnx-workspace-patterns\u002FSKILL.md",[],[]]