jpskill.com
📦 その他 コミュニティ

animation

Motionライブラリを活用し、コンポーネントに動き、トランジション、ジェスチャー、スクロール効果、インタラクティブなアニメーションなどを実装する際に、実装依頼に応じて具体的なアニメーションを実現するSkill。

📜 元の英語説明(参考)

Implement animations using the Motion library. Use when adding motion, transitions, gestures, scroll effects, or interactive animations to components. Triggered by implementation requests, not conceptual discussions.

🇯🇵 日本人クリエイター向け解説

一言でいうと

Motionライブラリを活用し、コンポーネントに動き、トランジション、ジェスチャー、スクロール効果、インタラクティブなアニメーションなどを実装する際に、実装依頼に応じて具体的なアニメーションを実現するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o animation.zip https://jpskill.com/download/9746.zip && unzip -o animation.zip && rm animation.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/9746.zip -OutFile "$d\animation.zip"; Expand-Archive "$d\animation.zip" -DestinationPath $d -Force; ri "$d\animation.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して animation.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → animation フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Motion を用いたアニメーション実装

すべてのアニメーション作業には Motion ライブラリ (https://motion.dev) を使用します。

クイックスタート

React (主要):

import { motion } from "motion/react"

// 基本的なアニメーション
<motion.div animate={{ opacity: 1, y: 0 }} />

// transition 設定付き
<motion.div
  animate={{ x: 100 }}
  transition={{ type: "spring", stiffness: 100 }}
/>

コアパターン

1. スプリング物理演算 (推奨)

<motion.div
  animate={{ scale: 1 }}
  transition={{
    type: 'spring',
    stiffness: 260,
    damping: 20,
  }}
/>

スプリングのプリセット:

  • Gentle: stiffness: 120, damping: 14
  • Wobbly: stiffness: 180, damping: 12
  • Stiff: stiffness: 300, damping: 20

2. ジェスチャーインタラクション

<motion.div
  whileHover={{ scale: 1.05 }}
  whileTap={{ scale: 0.95 }}
  drag="x"
  dragConstraints={{ left: -100, right: 100 }}
/>

3. レイアウトアニメーション

<motion.div layout>{/* 位置/サイズが変化するコンテンツ */}</motion.div>

4. スクロール連動エフェクト

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

const { scrollYProgress } = useScroll()
const opacity = useTransform(scrollYProgress, [0, 1], [1, 0])

<motion.div style={{ opacity }} />

5. 子要素の Stagger

<motion.ul
  variants={{
    visible: { transition: { staggerChildren: 0.07 } },
  }}
>
  {items.map((item) => (
    <motion.li
      key={item}
      variants={{
        hidden: { opacity: 0, y: 20 },
        visible: { opacity: 1, y: 0 },
      }}
    />
  ))}
</motion.ul>

6. Enter/Exit アニメーション

import { AnimatePresence } from 'motion/react';

<AnimatePresence>
  {show && <motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} />}
</AnimatePresence>;

アニメーションプロパティ

Transform (GPU アクセラレーション、高性能):

  • x, y, z - Translate
  • scale, scaleX, scaleY - Scale
  • rotate, rotateX, rotateY, rotateZ - Rotation
  • skew, skewX, skewY - Skew

Visual (控えめに使用、パフォーマンスに影響を与える可能性あり):

  • opacity
  • background, backgroundColor
  • color
  • borderRadius

SVG 固有:

  • pathLength - パス描画アニメーション用
  • pathOffset - パスをオフセット
  • pathSpacing - ダッシュ間の間隔

アクセシビリティ

常にユーザー設定を尊重してください。

<motion.div
  animate={{ x: 100 }}
  transition={{
    type: 'spring',
    // ユーザーがモーションの軽減を希望する場合、アニメーションを無効にします
    duration: 0,
  }}
/>

Motion は prefers-reduced-motion を自動的に処理します。スプリングは即時トランジションになります。

パフォーマンスのヒント

  1. 可能な限り transform/opacity のみをアニメーション化します (GPU アクセラレーション)。
  2. 幅/高さを手動でアニメーション化する代わりに layout プロパティを使用します。
  3. 可能な限り、スクロール中のアニメーションを避けてください
  4. 複雑なアニメーションには will-change: transform を使用します (Motion がこれを処理します)。
  5. 同時アニメーションを制限します - すべてを一度に行うのではなく、stagger を使用します。

設計原則 (概要)

アニメーションを使用するタイミング

  • 状態の遷移 (loading → success)
  • 空間的な変化 (ビューへの出入り)
  • 注意を引く (控えめに)
  • ユーザーアクションの確認

アニメーションを使用しないタイミング

  • 最初の発生後の繰り返しアクション
  • パフォーマンスが重要なパス
  • ユーザー制御のスクロール
  • すべてのインタラクション (抑制が重要)

タイミングのガイドライン

  • マイクロインタラクション: 150-250ms
  • パネル/モーダルのトランジション: 200-300ms
  • ページトランジション: 300-500ms
  • スプリング: 物理演算に期間を決定させます

スプリング vs Duration

  • スプリングの使用: インタラクティブな要素、ジェスチャー、レイアウトの変更
  • Duration の使用: 意図的なシーケンス、振り付け、ローダー

詳細なアニメーションの考え方については、principles.md を参照してください。

一般的なパターン

Loading 状態:

<motion.div
  animate={{ rotate: 360 }}
  transition={{
    repeat: Infinity,
    duration: 1,
    ease: 'linear',
  }}
/>

Toast 通知:

<motion.div
  initial={{ x: 400, opacity: 0 }}
  animate={{ x: 0, opacity: 1 }}
  exit={{ x: 400, opacity: 0 }}
  transition={{ type: 'spring', stiffness: 300, damping: 30 }}
/>

Drawer:

<motion.div
  initial={{ x: '-100%' }}
  animate={{ x: 0 }}
  exit={{ x: '-100%' }}
  transition={{ type: 'spring', damping: 25 }}
/>

Accordion:

<motion.div
  animate={{ height: isOpen ? 'auto' : 0 }}
  transition={{ type: 'spring', bounce: 0 }}
  style={{ overflow: 'hidden' }}
/>

リソース

簡単なトラブルシューティング

アニメーションが実行されない?

  • 要素が条件付きでレンダリングされているかどうかを確認します (AnimatePresence を使用)。
  • ターゲット値が初期値と異なることを確認します。
  • CSS がオーバーライドしている可能性がないか確認します (例: !important)。

パフォーマンスの問題?

  • transform と opacity にこだわってください。
  • サイズをアニメーション化する代わりに layout プロパティを使用します。
  • ブラウザの DevTools の Performance タブを確認します。

レイアウトアニメーションがちらつく?

  • 親に position: relative があることを確認します。
  • 必要に応じて、親と子の両方に layout を追加します。
  • 競合する CSS トランジションがないか確認します。

注記

  • Motion は MIT ライセンスであり、本番環境に対応しています。
  • ハイブリッドエンジン: 120fps、GPU アクセラレーション
  • TypeScript のサポートが組み込まれています。
  • 最適なバンドルサイズのためにツリーシェイキング可能です。
  • React 18 以降 (Suspense を含む) で動作します。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Animation Implementation with Motion

Use the Motion library (https://motion.dev) for all animation work.

Quick Start

React (Primary):

import { motion } from "motion/react"

// Basic animation
<motion.div animate={{ opacity: 1, y: 0 }} />

// With transition config
<motion.div
  animate={{ x: 100 }}
  transition={{ type: "spring", stiffness: 100 }}
/>

Core Patterns

1. Spring Physics (Preferred)

<motion.div
  animate={{ scale: 1 }}
  transition={{
    type: 'spring',
    stiffness: 260,
    damping: 20,
  }}
/>

Spring presets:

  • Gentle: stiffness: 120, damping: 14
  • Wobbly: stiffness: 180, damping: 12
  • Stiff: stiffness: 300, damping: 20

2. Gesture Interactions

<motion.div
  whileHover={{ scale: 1.05 }}
  whileTap={{ scale: 0.95 }}
  drag="x"
  dragConstraints={{ left: -100, right: 100 }}
/>

3. Layout Animations

<motion.div layout>{/* Content that changes position/size */}</motion.div>

4. Scroll-Linked Effects

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

const { scrollYProgress } = useScroll()
const opacity = useTransform(scrollYProgress, [0, 1], [1, 0])

<motion.div style={{ opacity }} />

5. Stagger Children

<motion.ul
  variants={{
    visible: { transition: { staggerChildren: 0.07 } },
  }}
>
  {items.map((item) => (
    <motion.li
      key={item}
      variants={{
        hidden: { opacity: 0, y: 20 },
        visible: { opacity: 1, y: 0 },
      }}
    />
  ))}
</motion.ul>

6. Enter/Exit Animations

import { AnimatePresence } from 'motion/react';

<AnimatePresence>
  {show && <motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} />}
</AnimatePresence>;

Animation Properties

Transform (GPU-accelerated, performant):

  • x, y, z - Translate
  • scale, scaleX, scaleY - Scale
  • rotate, rotateX, rotateY, rotateZ - Rotation
  • skew, skewX, skewY - Skew

Visual (use sparingly, can affect performance):

  • opacity
  • background, backgroundColor
  • color
  • borderRadius

SVG-specific:

  • pathLength - For path drawing animations
  • pathOffset - Offset the path
  • pathSpacing - Spacing between dashes

Accessibility

Always respect user preferences:

<motion.div
  animate={{ x: 100 }}
  transition={{
    type: 'spring',
    // Disables animation if user prefers reduced motion
    duration: 0,
  }}
/>

Motion automatically handles prefers-reduced-motion. Springs become instant transitions.

Performance Tips

  1. Animate transforms/opacity only when possible (GPU-accelerated)
  2. Use layout prop instead of animating width/height manually
  3. Avoid animating during scroll when possible
  4. Use will-change: transform for complex animations (Motion handles this)
  5. Limit simultaneous animations - stagger instead of all-at-once

Design Principles (Brief)

When to Animate

  • State transitions (loading → success)
  • Spatial changes (entering/exiting view)
  • Drawing attention (sparingly)
  • Confirming user action

When NOT to Animate

  • Repeated actions after first occurrence
  • Performance-critical paths
  • User-controlled scrolling
  • Every single interaction (restraint matters)

Timing Guidelines

  • Micro-interactions: 150-250ms
  • Panel/modal transitions: 200-300ms
  • Page transitions: 300-500ms
  • Springs: Let physics determine duration

Spring vs Duration

  • Use springs for: Interactive elements, gestures, layout changes
  • Use duration for: Intentional sequences, choreography, loaders

See principles.md for detailed animation philosophy.

Common Patterns

Loading state:

<motion.div
  animate={{ rotate: 360 }}
  transition={{
    repeat: Infinity,
    duration: 1,
    ease: 'linear',
  }}
/>

Toast notification:

<motion.div
  initial={{ x: 400, opacity: 0 }}
  animate={{ x: 0, opacity: 1 }}
  exit={{ x: 400, opacity: 0 }}
  transition={{ type: 'spring', stiffness: 300, damping: 30 }}
/>

Drawer:

<motion.div
  initial={{ x: '-100%' }}
  animate={{ x: 0 }}
  exit={{ x: '-100%' }}
  transition={{ type: 'spring', damping: 25 }}
/>

Accordion:

<motion.div
  animate={{ height: isOpen ? 'auto' : 0 }}
  transition={{ type: 'spring', bounce: 0 }}
  style={{ overflow: 'hidden' }}
/>

Resources

Quick Troubleshooting

Animation not running?

  • Check if element is conditionally rendered (use AnimatePresence)
  • Verify target values are different from initial values
  • Check for CSS that might override (e.g., !important)

Performance issues?

  • Stick to transforms and opacity
  • Use layout prop instead of animating dimensions
  • Check browser DevTools Performance tab

Layout animations flickering?

  • Ensure parent has position: relative
  • Add layout to both parent and child if needed
  • Check for conflicting CSS transitions

Notes

  • Motion is MIT licensed, production-ready
  • Hybrid engine: 120fps, GPU-accelerated
  • TypeScript support built-in
  • Tree-shakable for optimal bundle size
  • Works with React 18+ (including Suspense)