Communitygithub.com

Motion (Framer Motion) — React UI 애니메이션 라이브러리

React를 위한 선언적 애니메이션 라이브러리입니다. 스프링, 제스처, 레이아웃 애니메이션, 페이지 전환을 지원하며 GPU 가속으로 프로덕션에 바로 사용할 수 있습니다.

Motion (Framer Motion) — React UI 애니메이션 라이브러리란 무엇인가요?

이 스킬은 Motion (이전 Framer Motion) 라이브러리를 상세히 설명하며, React 애플리케이션에서 선언적이고 고성능의 UI 애니메이션을 구현하는 방법을 안내합니다. 스프링 물리 기반의 자연스러운 모션부터, 마운트/언마운트 시 애니메이션, 제스처(호버, 탭, 드래그), 레이아웃 애니메이션, 스크롤 연동 애니메이션까지 폭넓은 API를 제공합니다. 특히 variants를 통한 자식 애니메이션 조율, AnimatePresence를 활용한 페이지 전환, layoutId를 이용한 요소 간 형태 변환 등 고급 패턴을 코드 예제와 함께 설명합니다. 웹 개발자 및 AI 에이전트가 React UI에 동적 인터랙션을 빠르고 효율적으로 추가할 수 있도록 돕습니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ever-just/agentskills/tree/HEAD/skills/framer-motion

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

Motion (Framer Motion) — React UI 애니메이션 라이브러리은(는) 무엇을 하나요?

React를 위한 선언적 애니메이션. 스프링, 제스처, 레이아웃 애니메이션, 페이지 전환. GPU 가속, 프로덕션 준비 완료.

개요

  • 저장소: github.com/motiondivision/motion (26K+ 스타)
  • 언어: TypeScript / React
  • 라이선스: MIT
  • 설치: npm install motion
  • 문서: motion.dev
  • 참고: Framer Motion이 Motion으로 이름이 변경되었습니다. motion/react에서 가져오세요.

핵심 API

기본 애니메이션

import { motion } from "motion/react";

// 마운트 시 애니메이션
<motion.div
  initial={{ opacity: 0, y: 20 }}
  animate={{ opacity: 1, y: 0 }}
  transition={{ duration: 0.5 }}
>
  안녕하세요
</motion.div>

// 언마운트 시 애니메이션 (AnimatePresence 필요)
import { AnimatePresence } from "motion/react";

<AnimatePresence>
  {isVisible && (
    <motion.div
      initial={{ opacity: 0 }}
      animate={{ opacity: 1 }}
      exit={{ opacity: 0 }}
    >
      내용
    </motion.div>
  )}
</AnimatePresence>

스프링 물리

<motion.div
  animate={{ x: 100 }}
  transition={{
    type: "spring",
    stiffness: 300,
    damping: 20,
    mass: 1,
  }}
/>

// 프리셋
transition={{ type: "spring", bounce: 0.5 }}  // 0 = 튕김 없음, 1 = 매우 많이 튕김

변형 (오케스트레이션 애니메이션)

const container = {
  hidden: { opacity: 0 },
  show: {
    opacity: 1,
    transition: {
      staggerChildren: 0.1,    // 자식 간 지연 시간
      delayChildren: 0.3,       // 초기 지연 시간
    },
  },
};

const item = {
  hidden: { opacity: 0, y: 20 },
  show: { opacity: 1, y: 0 },
};

<motion.ul variants={container} initial="hidden" animate="show">
  {items.map((i) => (
    <motion.li key={i} variants={item}>{i}</motion.li>
  ))}
</motion.ul>

제스처

// 호버
<motion.button
  whileHover={{ scale: 1.05 }}
  whileTap={{ scale: 0.95 }}
>
  클릭하세요
</motion.button>

// 드래그
<motion.div
  drag                          // 양축 드래그 활성화
  dragConstraints={{ left: -100, right: 100, top: -50, bottom: 50 }}
  dragElastic={0.2}
/>

레이아웃 애니메이션

// 레이아웃 변경 자동 애니메이션
<motion.div layout>
  {isExpanded ? <확장된내용 /> : <접힌내용 />}
</motion.div>

// 공유 레이아웃 애니메이션 (요소 간 형태 변환)
<motion.div layoutId="card">
  {/* layoutId가 일치하면 이 요소가 위치 간에 형태가 변환됩니다 */}
</motion.div>

스크롤 애니메이션

import { useScroll, useTransform, motion } from "motion/react";

function 시차섹션() {
  const { scrollYProgress } = useScroll();
  const y = useTransform(scrollYProgress, [0, 1], [0, -200]);
  const opacity = useTransform(scrollYProgress, [0, 0.5, 1], [1, 1, 0]);

  return (
    <motion.div style={{ y, opacity }}>
      시차 콘텐츠
    </motion.div>
  );
}

useAnimate (명령형)

import { useAnimate } from "motion/react";

function 내컴포넌트() {
  const [scope, animate] = useAnimate();

  async function handleClick() {
    await animate(".box", { scale: 1.5 }, { duration: 0.3 });
    await animate(".box", { rotate: 360 }, { duration: 0.5 });
    await animate(".box", { scale: 1, rotate: 0 });
  }

  return (
    <div ref={scope}>
      <div className="box" onClick={handleClick}>클릭하세요</div>
    </div>
  );
}

키프레임

<motion.div
  animate={{
    x: [0, 100, 100, 0, 0],
    y: [0, 0, 100, 100, 0],
    rotate: [0, 90, 180, 270, 360],
  }}
  transition={{ duration: 2, repeat: Infinity }}
/>

전환 유형

// 스프링 (물리 값에 대한 기본값)
transition={{ type: "spring", stiffness: 100, damping: 10 }}

// Tween (지속 시간 기반)
transition={{ type: "tween", duration: 0.5, ease: "easeInOut" }}

// 이징 옵션
ease: "linear" | "easeIn" | "easeOut" | "easeInOut"
ease: [0.42, 0, 0.58, 1]  // 사용자 정의 큐빅 베지어

// 반복
transition={{ repeat: Infinity, repeatType: "reverse", duration: 1 }}

// 지연
transition={{ delay: 0.5 }}

일반적인 패턴

페이지 전환

// 레이아웃 컴포넌트 내부
<AnimatePresence mode="wait">
  <motion.div
    key={pathname}
    initial={{ opacity: 0, x: 20 }}
    animate={{ opacity: 1, x: 0 }}
    exit={{ opacity: 0, x: -20 }}
    transition={{ duration: 0.3 }}
  >
    {children}
  </motion.div>
</AnimatePresence>

지연 리스트

const container = {
  hidden: {},
  show: { transition: { staggerChildren: 0.08 } },
};
const item = {
  hidden: { opacity: 0, y: 15 },
  show: { opacity: 1, y: 0, transition: { type: "spring", bounce: 0.3 } },
};

호버 시 확대 카드

<motion.div
  whileHover={{ scale: 1.03, boxShadow: "0 10px 30px rgba(0,0,0,0.15)" }}
  transition={{ type: "spring", stiffness: 400, damping: 25 }}
/>

모범 사례

  1. 변형 사용 — 부모/자식 애니메이션 오케스트레이션에 활용
  2. 스프링 물리 — 자연스러운 느낌의 모션에 사용 (선형 이징 피할 것)
  3. layout prop — 자동 레이아웃 변경 애니메이션에 사용
  4. AnimatePresence — 종료 애니메이션에 필수
  5. layoutId — 라우트 간 공유 요소 전환에 사용
  6. useScroll — 스크롤 연동 애니메이션 (시차, 진행 막대)에 사용
  7. whileHover/whileTap — 상호작용 피드백에 사용
  8. 자식 지연 — 변형 transition.staggerChildren을 통해 설정
  9. 애니메이션은 미묘하게 — UI 상호작용에 0.2-0.5초 지속 시간 사용
  10. GPU 가속 — Motion은 기본적으로 transform을 사용

Motion vs GSAP 사용 시기

항목MotionGSAP
프레임워크React 우선프레임워크 중립
스타일선언형 (JSX props)명령형 (함수 호출)
레이아웃 애니메이션내장 (매직)수동
스크롤useScroll 훅ScrollTrigger 플러그인
제스처내장 (드래그, 호버, 탭)Draggable 플러그인
SVG 변형제한적MorphSVGPlugin
번들 크기~30KB~25KB 코어

출처

  • 저장소: github.com/motiondivision/motion
  • 문서: motion.dev
  • 예제: motion.dev/docs/react-quick-start

Individual skills in this repo

This repo contains 9 individual skills — each has its own dedicated page.

ever-just/agentskills

> Create animated logos, icons, and micro-interactions as lightweight Lottie JSON files. No After Effects needed — build animations entirely in code.

ever-just/agentskills

> A TypeScript library using generators to program animations with a real-time editor. Ideal for explainer videos, code walkthroughs, and educational content.

ever-just/agentskills

> Add animated subtitles and captions to Remotion videos from .SRT files. TikTok-style word-by-word highlights, karaoke effects, and more.

ever-just/agentskills

> Create videos programmatically using React components. The most mature framework for code-driven video production.

ever-just/agentskills

> Copy-paste video components for Remotion. Intros, text effects, transitions, and full scene templates. Like shadcn/ui but for video.

ever-just/agentskills

Extract actionable intelligence from video content across YouTube, Vimeo, and company websites. Video reveals what text sources cannot: facility scale, team composition, product demonstrations, signage, event attendance, and operational reality.

ever-just/agentskills

Optimize and embed an existing video as a fast, crisp, autoplaying hero/background/loop on a website. Use when adding or replacing a video on a marketing site and it is too heavy, will not autoplay (especially on mobile/Safari), shows a codec error, or looks soft — to transcode it to web-safe H.264 with the right pixel format, faststart, retina-aware sizing, and a poster frame, then embed and verify it actually plays. This is optimization + embedding of footage you already have, not creating/animating a video (for that use remotion/moviepy/motion-canvas). Use when the user says "add this video to the site", "the hero video is too big / won't play / isn't crisp", "replace the homepage video", or "make this loop on the landing page".

ever-just/agentskills

Full conversion audit for any homepage or landing page. Use when someone asks to "review my homepage," "audit my landing page," "why isn't my page converting," "check my website," or wants feedback on their marketing page. Requires URL or screenshot before proceeding.

ever-just/agentskills

Automatically fetch YouTube video transcripts, generate structured summaries, and send full transcripts to messaging platforms. Detects YouTube URLs and provides metadata, key insights, and downloadable transcripts.

관련 스킬