web-animation-framer-motion
Framer Motion(旧Motion)のアニメーションパターンを活用し、コンポーネント、ジェスチャー、レイアウト、スクロール連動など、Webサイトに動きのある表現を手軽に追加し、アクセシビリティにも配慮したアニメーションを実装するSkill。
📜 元の英語説明(参考)
Motion (formerly Framer Motion) animation patterns - motion components, variants, gestures, layout animations, scroll-linked animations, accessibility
🇯🇵 日本人クリエイター向け解説
Framer Motion(旧Motion)のアニメーションパターンを活用し、コンポーネント、ジェスチャー、レイアウト、スクロール連動など、Webサイトに動きのある表現を手軽に追加し、アクセシビリティにも配慮したアニメーションを実装するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o web-animation-framer-motion.zip https://jpskill.com/download/10272.zip && unzip -o web-animation-framer-motion.zip && rm web-animation-framer-motion.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/10272.zip -OutFile "$d\web-animation-framer-motion.zip"; Expand-Archive "$d\web-animation-framer-motion.zip" -DestinationPath $d -Force; ri "$d\web-animation-framer-motion.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
web-animation-framer-motion.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
web-animation-framer-motionフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
Motion Animation Patterns
クイックガイド: 宣言的な React アニメーションには Motion を使用します。基本的なアニメーションには
motion.*コンポーネント、オーケストレーションされたシーケンスには variants、終了アニメーションには AnimatePresence、FLIP アニメーションにはlayout/layoutId、スクロールトリガーエフェクトにはuseScroll/useInViewを使用します。GPU パフォーマンスのために、常に transform プロパティ (x, y, scale, rotate, opacity) をアニメーション化してください。MotionConfig reducedMotion="user"を使用して、常にモーション軽減を尊重してください。
インポート:
import { motion } from "motion/react"(v11+ パッケージはframer-motionからリネームされました)
<critical_requirements>
重要: この Skill を使用する前に
すべてのコードは CLAUDE.md のプロジェクト規約に従う必要があります (kebab-case、名前付きエクスポート、インポート順、
import type、名前付き定数)
(終了アニメーションを機能させるには、既存のコンポーネントを AnimatePresence でラップする必要があります)
(AnimatePresence の直接の子には、一意の key プロパティを指定する必要があります)
(GPU アクセラレーションされたパフォーマンスを得るには、transform プロパティ (x, y, scale, rotate, opacity) をアニメーション化する必要があります)
(MotionConfig または useReducedMotion を使用して、モーション軽減の設定を尊重する必要があります)
(すべてのアニメーションタイミング値には、名前付き定数を使用する必要があります - マジックナンバーは使用しないでください)
</critical_requirements>
自動検出: Motion, Framer Motion, motion.div, motion.button, AnimatePresence, useAnimation, useScroll, useInView, usePageInView, variants, whileHover, whileTap, layoutId, spring, tween, stagger, "motion/react", "framer-motion"
使用する場面:
- コンポーネントのエンター/エグジット/プレゼンスのアニメーション
- variants を使用した複雑なマルチエレメントアニメーションのオーケストレーション
- ジェスチャーベースのインタラクション (hover, tap, drag) の実装
- スクロールトリガーまたはスクロールリンクされたアニメーションの作成
- レイアウトの変更と共有要素のトランジションのアニメーション
- マイクロインタラクションと UI フィードバックの構築
使用しない場面:
- 単純な CSS トランジション (代わりに CSS トランジションを使用してください)
- フレームレベルの制御を必要とする複雑なタイムラインベースのアニメーション (専用のタイムラインアニメーションライブラリを検討してください)
- 慎重な最適化なしに、低電力デバイスでのパフォーマンスが重要なアニメーション
カバーする主要なパターン:
- motion コンポーネントとアニメーションプロパティ (initial, animate, exit, transition)
- 再利用可能でオーケストレーションされたアニメーションのための Variants
- 終了アニメーションとアニメーションモードのための AnimatePresence
- ジェスチャープロパティ (whileHover, whileTap, whileDrag, drag)
- レイアウトアニメーション (layout プロパティ, layoutId, LayoutGroup)
- スクロールアニメーション (useScroll, useInView, whileInView)
- Spring と tween トランジション
- 命令的な制御のための useAnimation
- モーション軽減アクセシビリティ
- v12: usePageInView, 拡張された stagger(), drag stop/cancel
詳細なリソース:
- examples/core.md - Motion コンポーネント、variants、AnimatePresence、ジェスチャー、アクセシビリティ
- examples/layout.md - レイアウトアニメーション、共有要素、展開可能なカード
- examples/scroll.md - スクロールプログレス、リビール、パララックス
- examples/sequences.md - 複雑なシーケンス、キーフレーム
- examples/svg.md - SVG パスアニメーション
- reference.md - 意思決定フレームワーク、移行ガイド、アンチパターン、パフォーマンス、クイックリファレンス
<philosophy>
Philosophy
Motion は、アニメーションを自然でアクセスしやすくする React 用の宣言的なアニメーションライブラリです。デフォルトとして spring アニメーションを使用した物理ベースのアプローチを使用し、現実世界の期待に一致する流動的なモーションを作成します。
コア原則:
- 命令型よりも宣言型 - アニメーションをどのように実現するかではなく、どのように見えるかを記述します
- キーフレームよりもプロパティ - CSS キーフレームの代わりに
initial、animate、exitプロパティを使用します - オーケストレーションのための Variants - 関連するアニメーションをグループ化し、親子関係でタイミングを制御します
- 変換によるパフォーマンス - スムーズな 60fps のために、GPU アクセラレーションされたプロパティ (transform, opacity) をアニメーション化します
- 組み込みのアクセシビリティ - モーション軽減に関するユーザー設定を尊重します
</philosophy>
<patterns>
コアパターン
パターン 1: 基本的な Motion コンポーネント
任意の HTML または SVG 要素に motion. をプレフィックスとして付けると、アニメーション化可能になります。initial、animate、exit、および transition プロパティを使用します。
import { motion } from "motion/react";
const FADE_DURATION_S = 0.3;
const SLIDE_DISTANCE_PX = 20;
export const FadeIn = ({ children }: { children: React.ReactNode }) => (
<motion.div
initial={{ opacity: 0, y: SLIDE_DISTANCE_PX }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: FADE_DURATION_S }}
>
{children}
</motion.div>
);
良い理由: 名前付き定数、宣言的な意図、y は GPU アクセラレーションされています (top/left/margin は絶対にアニメーション化しないでください)
className、delay プロパティ、および悪い例を含む完全な例については、examples/core.md パターン 1 を参照してください。
パターン 2: オーケストレーションされたアニメーションのための Variants
Variants は再利用可能なアニメーション状態を定義し、staggerChildren を使用した親子オーケストレーションを可能にします。
import { motion, type Variants } from "motion/react";
const STAGGER_DELAY_S = 0.1;
const ITEM_DISTANCE_PX = 20;
const containerVariants: Variants = {
hidden: { opacity: 0 },
visible: { opacity: 1, transition: { staggerChildren: STAGGER_DELAY_S } },
};
const itemVariants: Variants = {
hidden: { opacity: 0, y: ITEM_DISTANCE_PX },
visible: { opacity: 1, y: 0 },
};
子は親からアニメーション状態を自動的に継承します。終了時にリバース stagger を行うには、staggerDirection: -1 を使用します。
終了 variants を含む完全なリストアニメーションについては、examples/core.md パターン 2 を参照してください。
パターン 3: 終了アニメーションのための AnimatePresence
AnimatePresence は、React ツリーから削除されるコンポーネントの終了アニメーションを有効にします。直接の子は必ず一意の key プロパティを持つ必要があります。
import { AnimatePresence, motion } from "motion/react";
const MODAL_SCALE_HIDDEN = 0.95;
<AnimatePresence>
{isOpen && (
<motion.div
key="modal"
initia
(原文がここで切り詰められています) 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Motion Animation Patterns
Quick Guide: Use Motion for declarative React animations.
motion.*components for basic animations, variants for orchestrated sequences, AnimatePresence for exit animations,layout/layoutIdfor FLIP animations,useScroll/useInViewfor scroll-triggered effects. Always animate transform properties (x, y, scale, rotate, opacity) for GPU performance. Always respect reduced motion viaMotionConfig reducedMotion="user".
Import:
import { motion } from "motion/react"(v11+ package rename fromframer-motion)
<critical_requirements>
CRITICAL: Before Using This Skill
All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering,
import type, named constants)
(You MUST wrap exiting components in AnimatePresence for exit animations to work)
(You MUST provide unique key prop to direct children of AnimatePresence)
(You MUST animate transform properties (x, y, scale, rotate, opacity) for GPU-accelerated performance)
(You MUST respect reduced motion preferences using MotionConfig or useReducedMotion)
(You MUST use named constants for all animation timing values - NO magic numbers)
</critical_requirements>
Auto-detection: Motion, Framer Motion, motion.div, motion.button, AnimatePresence, useAnimation, useScroll, useInView, usePageInView, variants, whileHover, whileTap, layoutId, spring, tween, stagger, "motion/react", "framer-motion"
When to use:
- Animating component enter/exit/presence
- Orchestrating complex multi-element animations with variants
- Implementing gesture-based interactions (hover, tap, drag)
- Creating scroll-triggered or scroll-linked animations
- Animating layout changes and shared element transitions
- Building micro-interactions and UI feedback
When NOT to use:
- Simple CSS transitions (use CSS transitions instead)
- Complex timeline-based animations requiring frame-level control (consider a dedicated timeline animation library)
- Performance-critical animations on low-powered devices without careful optimization
Key patterns covered:
- motion components and animation props (initial, animate, exit, transition)
- Variants for reusable, orchestrated animations
- AnimatePresence for exit animations and animation modes
- Gesture props (whileHover, whileTap, whileDrag, drag)
- Layout animations (layout prop, layoutId, LayoutGroup)
- Scroll animations (useScroll, useInView, whileInView)
- Spring and tween transitions
- useAnimation for imperative control
- Reduced motion accessibility
- v12: usePageInView, enhanced stagger(), drag stop/cancel
Detailed Resources:
- examples/core.md - Motion components, variants, AnimatePresence, gestures, accessibility
- examples/layout.md - Layout animations, shared elements, expandable cards
- examples/scroll.md - Scroll progress, reveal, parallax
- examples/sequences.md - Complex sequences, keyframes
- examples/svg.md - SVG path animations
- reference.md - Decision frameworks, migration guide, anti-patterns, performance, quick reference
<philosophy>
Philosophy
Motion is a declarative animation library for React that makes animations feel natural and accessible. It uses a physics-based approach with spring animations as defaults, creating fluid motion that matches real-world expectations.
Core principles:
- Declarative over imperative - Describe what the animation should look like, not how to achieve it
- Props over keyframes - Use
initial,animate,exitprops instead of CSS keyframes - Variants for orchestration - Group related animations and control timing with parent-child relationships
- Performance through transforms - Animate GPU-accelerated properties (transform, opacity) for smooth 60fps
- Accessibility built-in - Respect user preferences for reduced motion
</philosophy>
<patterns>
Core Patterns
Pattern 1: Basic Motion Components
Prefix any HTML or SVG element with motion. to make it animatable. Use initial, animate, exit, and transition props.
import { motion } from "motion/react";
const FADE_DURATION_S = 0.3;
const SLIDE_DISTANCE_PX = 20;
export const FadeIn = ({ children }: { children: React.ReactNode }) => (
<motion.div
initial={{ opacity: 0, y: SLIDE_DISTANCE_PX }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: FADE_DURATION_S }}
>
{children}
</motion.div>
);
Why good: Named constants, declarative intent, y is GPU-accelerated (never animate top/left/margin)
See examples/core.md Pattern 1 for full examples with className, delay props, and bad examples.
Pattern 2: Variants for Orchestrated Animations
Variants define reusable animation states and enable parent-child orchestration with staggerChildren.
import { motion, type Variants } from "motion/react";
const STAGGER_DELAY_S = 0.1;
const ITEM_DISTANCE_PX = 20;
const containerVariants: Variants = {
hidden: { opacity: 0 },
visible: { opacity: 1, transition: { staggerChildren: STAGGER_DELAY_S } },
};
const itemVariants: Variants = {
hidden: { opacity: 0, y: ITEM_DISTANCE_PX },
visible: { opacity: 1, y: 0 },
};
Children automatically inherit animation state from parent. Use staggerDirection: -1 for reverse stagger on exit.
See examples/core.md Pattern 2 for complete list animation with exit variants.
Pattern 3: AnimatePresence for Exit Animations
AnimatePresence enables exit animations for components being removed from the React tree. Direct children must have unique key props.
import { AnimatePresence, motion } from "motion/react";
const MODAL_SCALE_HIDDEN = 0.95;
<AnimatePresence>
{isOpen && (
<motion.div
key="modal"
initial={{ opacity: 0, scale: MODAL_SCALE_HIDDEN }}
animate={{ opacity: 1, scale: 1 }}
exit={{ opacity: 0, scale: MODAL_SCALE_HIDDEN }}
/>
)}
</AnimatePresence>
Animation modes: mode="sync" (default, simultaneous), mode="wait" (wait for exit before enter - ideal for page transitions), mode="popLayout" (for shared layout transitions).
See examples/core.md Pattern 3 for modal and page transition examples.
Pattern 4: Gesture Animations
Gesture props enable hover, tap, focus, and drag interactions.
const HOVER_SCALE = 1.05;
const TAP_SCALE = 0.95;
const GESTURE_SPRING = { type: "spring" as const, stiffness: 400, damping: 17 };
<motion.button
whileHover={{ scale: HOVER_SCALE }}
whileTap={{ scale: TAP_SCALE }}
transition={GESTURE_SPRING}
/>
For drag: use drag, dragConstraints, dragElastic, whileDrag. Use useDragControls for programmatic drag (v12+ adds .stop()/.cancel()).
See examples/core.md Pattern 4 for interactive card and draggable element examples.
Pattern 5: Layout Animations
The layout prop animates layout changes automatically using FLIP technique. Use layout="position" on children to prevent text distortion. Use layoutId for shared element transitions across different containers.
<motion.div layout transition={LAYOUT_SPRING}>
<motion.h2 layout="position">Title</motion.h2>
</motion.div>
// Shared element: layoutId creates seamless transitions
{activeTab === tab && <motion.div layoutId="indicator" />}
Use LayoutGroup with id prop to scope layoutId to component instances (layoutId is global by default).
See examples/layout.md for expandable cards and tab indicator examples.
Pattern 6: Scroll-Triggered Animations
whileInView for scroll-triggered animations. useScroll + useTransform for scroll-linked effects.
const REVEAL_DISTANCE_PX = 50;
const PARALLAX_RANGE_PX = 100;
// Scroll-triggered (fires once)
<motion.div
initial={{ opacity: 0, y: REVEAL_DISTANCE_PX }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, margin: "-100px" }}
/>
// Scroll-linked (continuous)
const { scrollYProgress } = useScroll({ target: ref, offset: ["start end", "end start"] });
const y = useTransform(scrollYProgress, [0, 1], [-PARALLAX_RANGE_PX, PARALLAX_RANGE_PX]);
Motion values from useScroll update without React re-renders.
See examples/scroll.md for progress bar, parallax, and reveal examples.
Pattern 7: Spring and Tween Transitions
// Springs - physics-based, natural feel
const BOUNCY = { type: "spring", stiffness: 300, damping: 10 }; // Playful
const SNAPPY = { type: "spring", stiffness: 500, damping: 30 }; // Responsive
const GENTLE = { type: "spring", stiffness: 100, damping: 20 }; // Subtle
// Tweens - duration-based, precise control
const ENTER = { type: "tween", ease: "easeOut", duration: 0.3 }; // Enter
const EXIT = { type: "tween", ease: "easeIn", duration: 0.2 }; // Exit
Rule of thumb: Springs for interactive elements (buttons, cards), tweens for UI transitions (modals, page changes).
See reference.md for full transition type reference with additional presets.
Pattern 8: useAnimation for Imperative Control
Use useAnimation when you need programmatic control over animations triggered by external events, complex sequences, or start/stop behavior.
const SHAKE_DISTANCE_PX = 10;
const SHAKE_DURATION_S = 0.3;
const controls = useAnimation();
useEffect(() => {
if (hasError) {
controls.start({
x: [0, -SHAKE_DISTANCE_PX, SHAKE_DISTANCE_PX, -SHAKE_DISTANCE_PX, 0],
transition: { duration: SHAKE_DURATION_S },
});
}
}, [hasError, controls]);
<motion.div animate={controls}>{children}</motion.div>
See examples/sequences.md for multi-step sequences and keyframe animations.
Pattern 9: Reduced Motion Accessibility
Always respect user preferences for reduced motion.
// Site-wide: wrap app root
<MotionConfig reducedMotion="user">{children}</MotionConfig>
// Per-component: custom handling
const FULL_DISTANCE_PX = 50;
const FULL_DURATION_S = 0.5;
const REDUCED_DURATION_S = 0.2;
const shouldReduceMotion = useReducedMotion();
<motion.div
initial={{ opacity: 0, y: shouldReduceMotion ? 0 : FULL_DISTANCE_PX }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: shouldReduceMotion ? REDUCED_DURATION_S : FULL_DURATION_S }}
/>
MotionConfig reducedMotion="user" automatically disables transform/layout animations when reduced motion is preferred. Opacity and color animations still work.
See examples/core.md Pattern 5 for complete accessible animation component.
Pattern 10: v12 Features
usePageInView (v12.19+): Detect when page/tab is visible to pause animations or videos in background tabs. Returns boolean, defaults to true on server.
import { usePageInView } from "motion/react";
const isPageVisible = usePageInView();
Enhanced stagger() (v12+): Pass stagger() to delayChildren in variants for from and ease options.
import { stagger } from "motion/react";
// stagger() is passed to delayChildren, NOT staggerChildren
const transition = {
delayChildren: stagger(0.05, { from: "center", ease: "easeOut" }),
};
// from options: "first" (default), "center", "last", or number (index)
Drag Controls (v12+): useDragControls gains .stop() and .cancel() methods.
</patterns>
<red_flags>
RED FLAGS
High Priority Issues:
- Missing AnimatePresence for exit animations - exit prop has no effect without it
- Missing unique key on AnimatePresence children - cannot track elements
- Animating layout-triggering properties (height, width, top, left, margin, padding) - use transform (x, y, scale) instead
- Magic numbers for timing values - all durations, delays, distances must be named constants
- Ignoring reduced motion - always use
MotionConfig reducedMotion="user"oruseReducedMotion
Medium Priority Issues:
- Using index as key in animated lists - causes incorrect animations when list changes
- Missing
layout="position"on children during parent layout animation - children will distort - Overusing
willChange- creates GPU layers; Motion handles optimization automatically - Not cleaning up
useAnimationin useEffect - can cause memory leaks
Gotchas & Edge Cases:
layoutIdis global - use LayoutGroup with id prop to scope to component instancesAnimatePresence mode="wait"blocks enter until exit completes - may cause perceived delaywhileInViewusesviewportnotoffsetfor configuration (unlikeuseScroll)- SVG animations require
motion.path,motion.circle, etc. - regular SVG elements won't animate useInViewreturnsfalseon server - default to visible state for SSR- Motion values don't trigger re-renders (by design) - use
useMotionValueEventfor side effects - React Fragments inside AnimatePresence break tracking - each direct child must have a key
dragwithlayoutcan conflict - disable layout during drag or usedragListener- Spring animations can overshoot - high stiffness + low damping; test with real content
- v12
stagger()goes ondelayChildren, notstaggerChildren- they serve different purposes
</red_flags>
<critical_reminders>
CRITICAL REMINDERS
All code must follow project conventions in CLAUDE.md
(You MUST wrap exiting components in AnimatePresence for exit animations to work)
(You MUST provide unique key prop to direct children of AnimatePresence)
(You MUST animate transform properties (x, y, scale, rotate, opacity) for GPU-accelerated performance)
(You MUST respect reduced motion preferences using MotionConfig or useReducedMotion)
(You MUST use named constants for all animation timing values - NO magic numbers)
Failure to follow these rules will break exit animations, cause performance issues, and create inaccessible experiences.
</critical_reminders>