본문으로 건너뛰기
Skillpedia
인터페이스 (UI/UX)280k · #213

motion-patterns

하는 일

이 코드는 React나 Next.js로 만든 웹사이트를 위해 부드럽고 바로 쓸 수 있는 애니메이션을 만들도록 돕습니다. 버튼, 모달, 토스트 알림, 목록이 순서대로 나타나는 효과, 페이지 전환을 위한 패턴을 제공합니다.

사용하는 경우

  • ✓클릭하면 바뀌는 버튼을 애니메이션으로 만들 때.
  • ✓목록 항목이 하나씩 차례로 나타나게 만들 때.
  • ✓웹사이트에서 페이지를 바꿀 때 부드러운 전환을 만들 때.

스킬 링크

https://github.com/affaan-m/ECC/blob/main/pi/core/skills/motion-patterns/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/affaan-m/ECC/blob/main/pi/core/skills/motion-patterns/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“클릭하면 ‘눌리고’, 손을 떼면 원래대로 돌아오는 버튼 애니메이션을 만들어 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

미리 정의된 애니메이션 ‘패턴’을 사용하며, 이 패턴은 속도와 움직임 설정을 별도의 파일에서 가져옵니다. 이렇게 하면 애니메이션이 일관되고, 즉석에서 임의의 값을 쓰지 않습니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Motion Patterns

Copy-paste patterns for the most common UI animation needs. Every pattern here is built on motion-foundations tokens and springs. Do not define new duration or easing values here — import them.

When to Activate

  • Animating a button, card, modal, or toast notification
  • Building list entrances with stagger
  • Setting up page transitions in Next.js App Router
  • Adding entrance or exit animations to conditional content
  • Implementing scroll-reveal, scroll-linked progress, or sticky story sections
  • Building expanding cards, accordions, or shared-element transitions

Outputs

This skill produces:

  • Accessible, SSR-safe animation for all standard UI components
  • AnimatePresence-wrapped conditional renders with correct exit behavior
  • Page transition wrapper component for Next.js App Router
  • Scroll-reveal and scroll-linked patterns using useScroll + useTransform
  • Layout animation patterns (layout, layoutId) for expanding and crossfading elements

Principles

  • Every pattern imports from motion-foundations. No raw numbers.
  • Every conditional render is wrapped in AnimatePresence with a key.
  • Exit animations are always defined alongside enter animations — never as an afterthought.
  • layout is used only for small, isolated shifts. Large subtrees get explicit transforms.

Rules

  1. Always wrap conditional renders in AnimatePresence with a key on the direct child. Without a key, exit animations never fire.
  2. Always define exit when defining initial + animate. An animation without an exit is incomplete.
  3. Use mode="wait" on page transitions. Enter must not start until exit completes.
  4. Never use layout on subtrees with more than ~5 children or deeply nested DOM. Use explicit x/y transforms instead.
  5. Stagger interval must stay between 0.05s and 0.10s. Below feels mechanical; above feels sluggish.
  6. Modals must always include: focus trap, Escape-key close, scroll lock, role="dialog", aria-modal="true".
  7. Scroll reveals use viewport={{ once: true }}. Repeating on scroll-out is distracting, not informative.
  8. All token values are imported from motion-foundations. No inline numbers.

Decision Guidance

Choosing the right pattern

Situation Pattern
Element appears / disappears AnimatePresence
List of items loading in sequence Stagger variants
Navigating between routes Page transition wrapper
Element changes size in place layout prop
Same element moves across page contexts layoutId
Element enters when scrolled into view whileInView
Value tied to scroll position useScroll + useTransform

When to use mode="wait" vs mode="sync"

Mode Use when
wait Page transitions, content swaps (one at a time)
sync Stacked notifications, list items (overlap is fine)
popLayout Items removed from a reflow list

Core Concepts

AnimatePresence contract

Three things must always be true:

  1. AnimatePresence wraps the conditional
  2. The direct child has a key
  3. The child has an exit prop

Miss any one of these and the exit animation silently fails.

layout vs layoutId

  • layout — animates the element's own size/position change in place
  • layoutId — links two separate elements, crossfading between them across renders

Use layout="position" on text inside an expanding container to prevent text reflow from animating.

Code Examples

Button feedback

"use client"
import { motion } from "motion/react"
import { springs, motionTokens } from "@/lib/motion-tokens"

<motion.button
  whileHover={{ scale: motionTokens.scale.pop }}
  whileTap={{ scale: motionTokens.scale.press }}
  transition={springs.snappy}
/>

Stagger list

"use client"
import { motion } from "motion/react"
import { motionTokens, springs } from "@/lib/motion-tokens"

const container = {
  hidden: {},
  visible: {
    transition: {
      staggerChildren: 0.08,   // within the 0.05–0.10 rule
      delayChildren: 0.1,
    },
  },
}

const item = {
  hidden:  { opacity: 0, y: motionTokens.distance.md },
  visible: { opacity: 1, y: 0, transition: springs.gentle },
}


…
자주 묻는 질문

‘AnimatePresence’란 무엇인가요?

요소가 사라질 때 갑자기 없어지지 않고 애니메이션과 함께 사라지도록 보장하는 도구입니다.

‘토큰’과 ‘스프링’이란 무엇인가요?

‘토큰’은 외관에 대한 미리 정해진 설정이고, ‘스프링’은 움직임에 대한 설정입니다. 애니메이션 속도와 ‘탄력’ 같은 값으로 전체를 일관되게 유지합니다.

애니메이션에 숫자를 직접 쓰지 않는 이유는 무엇인가요?

미리 정해진 값(토큰)을 사용하면 사이트의 모든 애니메이션이 같은 느낌을 갖고, 필요할 때 쉽게 업데이트할 수 있습니다.

상세 정보

작성자의 원본 설명

Production-ready animation patterns for React / 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.

repo: affaan-m/ECC

인기도

GitHub 스타
280k
순위
#213
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬