jpskill.com
🛠️ 開発・MCP コミュニティ

web-animation-css-animations

CSSアニメーションの様々なパターン(トランジション、キーフレーム、スクロール連動、カスタムプロパティなど)を駆使し、GPUアクセラレーションやアクセシビリティにも配慮したWebアニメーションを実装するSkill。

📜 元の英語説明(参考)

CSS Animation patterns - transitions, keyframes, scroll-driven animations, @property, GPU-accelerated properties, accessibility with prefers-reduced-motion

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

一言でいうと

CSSアニメーションの様々なパターン(トランジション、キーフレーム、スクロール連動、カスタムプロパティなど)を駆使し、GPUアクセラレーションやアクセシビリティにも配慮したWebアニメーションを実装するSkill。

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

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

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

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

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

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して web-animation-css-animations.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → web-animation-css-animations フォルダができる
  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 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

CSSアニメーションのパターン

クイックガイド: 状態変化(hover、focus)にはCSS transitions、自律的/ループアニメーションには@keyframes、スクロール連動エフェクトにはスクロール駆動アニメーションを使用します。60fpsのためにはtransformopacityのみをアニメーション化します。常にprefers-reduced-motionを尊重してください。


<critical_requirements>

重要: このスキルを使用する前に

すべてのコードはCLAUDE.mdのプロジェクト規約に従う必要があります (kebab-case、名前付きエクスポート、インポート順、import type、名前付き定数)

(GPUアクセラレーションされた60fpsのパフォーマンスを得るためには、必ずtransformopacityのみをアニメーション化してください)

(オプトインには@media (prefers-reduced-motion: no-preference)、オプトアウトには@media (prefers-reduced-motion: reduce)を使用して、必ずprefers-reduced-motionを尊重してください)

(すべてのタイミング値にはCSSカスタムプロパティを使用してください - 0.3sのようなマジックナンバーは使用しないでください)

(enterアニメーションにはease-out、exitアニメーションにはease-inを使用してください - UIトランジションにlinearは絶対に使用しないでください)

(アニメーション完了後にはwill-changeを削除してください - 永続的なwill-changeはGPUメモリを浪費します)

</critical_requirements>


自動検出: CSS animation、CSS transition、@keyframes、transform、opacity、transition-duration、animation-duration、prefers-reduced-motion、scroll-timeline、animation-timeline、will-change、cubic-bezier、ease-out、ease-in、@property

使用する場面:

  • 単純な状態変化アニメーション(hover、focus、active状態)
  • 自律的なループアニメーション(スピナー、パルス、注意を引くもの)
  • スクロール連動アニメーションとパララックス効果
  • JavaScript制御を必要としないマイクロインタラクション

使用しない場面:

  • JavaScript制御を必要とするアニメーション(一時停止、逆再生、シーク) -- Web Animations APIを使用
  • 時間差のある複雑なオーケストレーションアニメーション -- アニメーションライブラリを使用
  • 物理ベースのスプリングアニメーション -- アニメーションライブラリを使用
  • ドラッグアンドドロップまたはジェスチャ駆動のアニメーション -- アニメーションライブラリを使用

詳細なリソース:

  • examples/core.md - トークンシステム、インタラクティブな状態、シャドウ、ローディング、モーションの削減
  • examples/transitions.md - 複数プロパティのトランジション、アコーディオン、色、リンク
  • examples/keyframes.md - スクロール駆動、@propertyグラデーション、タイプライター、ずらし、シェイプ
  • reference.md - 意思決定フレームワーク、タイミングリファレンス、ブラウザサポート

<philosophy>

哲学

CSSアニメーションは、ブラウザのコンポジタースレッドを活用して、JavaScriptの実行をブロックしないスムーズな60fpsのアニメーションを実現します。GPUアクセラレーションされたプロパティ(transformopacity)のみをアニメーション化することで、アニメーションはメインのJavaScriptスレッドとは別のスレッドで実行されます。

コア原則:

  1. パフォーマンス第一 - レイアウト/ペイントのトリガーを避けるために、transformopacityのみをアニメーション化する
  2. アクセシビリティを組み込む - 常にprefers-reduced-motionのユーザー設定を尊重する
  3. 状態変化にはトランジション - hover、focus、および状態駆動のアニメーションにはCSS transitionsを使用する
  4. 自律的なモーションにはキーフレーム - ループ、自動再生、または複数のステップを持つアニメーションには@keyframesを使用する
  5. 一貫性のためのデザイントークン - 期間、イージング、および距離にはCSSカスタムプロパティを使用する

</philosophy>


<patterns>

コアパターン

パターン1: アニメーショントークンシステム

一貫性のために、タイミング、イージング、および距離トークンをCSSカスタムプロパティとして定義します。完全なトークン設定については、examples/core.mdを参照してください。

:root {
  --duration-instant: 100ms;
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;

  --ease-out: cubic-bezier(0, 0, 0.2, 1); /* Enter */
  --ease-in: cubic-bezier(0.4, 0, 1, 1); /* Exit */
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1); /* Symmetric */
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Bouncy */

  --lift-sm: -2px;
  --lift-md: -4px;
}

トークンが重要な理由: アプリケーション全体で一貫したタイミング、グローバルに調整しやすい、セマンティックな命名が意図を伝える


パターン2: GPUアクセラレーションされたトランジション

transformopacityのみをアニメーション化します。widthheighttopleftmargin、またはpaddingのようなレイアウトプロパティは決してアニメーション化しないでください。

/* 正しい - GPUアクセラレーション */
.card {
  transition:
    transform var(--duration-fast) var(--ease-out),
    opacity var(--duration-fast) var(--ease-out);
}
.card:hover {
  transform: translateY(var(--lift-md)) scale(1.02);
}
/* 間違い - フレームごとにレイアウトの再計算をトリガーする */
.card {
  transition: all 0.3s linear;
}
.card:hover {
  top: -8px;
  margin-top: -8px;
}

Transformマッピング: top/leftの代わりにtranslate()width/heightの代わりにscale()box-shadowの代わりに疑似要素のopacityを使用します。

ボタンの状態、カードのhoverエフェクト、および疑似要素のシャドウテクニックについては、examples/core.mdを参照してください。


パターン3: Prefers-Reduced-Motion

すべてのアニメーションは、ユーザーのモーション設定を尊重する必要があります。2つの戦略があります。

プログレッシブエンハンスメント(推奨)

/* ベース: モーションなし */
.element {
  opacity: 1;
  transform: translateY(0);
}

/* モーションをオプトイン */
@media (prefers-reduced-motion: no-preference) {
  .element {
    animation: fade-slide-in var(--duration-normal) var(--ease-out);
  }
}

グレースフルデグラデーション

.notification {
  animation: slide-in-bounce var(--notification-duration) var(--ease-spring);
}

@media (prefers-reduced-motion: reduce) {
  .notification {
    animation: fade-in calc(var(--notification-duration) * 0.5) var(--ease-out);
  }
}

重要な洞察: モーションの削減は、アニメーションがないことを意味しません。Opacityのフェードは一般的に安全です。空間的な動きをopacityのみの代替手段に置き換えます。

完全なモーション削減パターンについては、examples/core.mdを参照してください。


パターン4: CSS @keyframes

ループする、マウント時に自動再生する、または3つ以上の状態を持つアニメーションには、@keyframesを使用します。


@keyframes fade-slide-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }


(原文はここで切り詰められています)
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

CSS Animation Patterns

Quick Guide: Use CSS transitions for state changes (hover, focus), @keyframes for autonomous/looping animations, scroll-driven animations for scroll-linked effects. Animate only transform and opacity for 60fps. Always respect prefers-reduced-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 animate ONLY transform and opacity for GPU-accelerated 60fps performance)

(You MUST respect prefers-reduced-motion using @media (prefers-reduced-motion: no-preference) for opt-in or @media (prefers-reduced-motion: reduce) for opt-out)

(You MUST use CSS custom properties for ALL timing values - NO magic numbers like 0.3s)

(You MUST use ease-out for enter animations and ease-in for exit animations - NEVER linear for UI transitions)

(You MUST remove will-change after animation completes - permanent will-change wastes GPU memory)

</critical_requirements>


Auto-detection: CSS animation, CSS transition, @keyframes, transform, opacity, transition-duration, animation-duration, prefers-reduced-motion, scroll-timeline, animation-timeline, will-change, cubic-bezier, ease-out, ease-in, @property

When to use:

  • Simple state change animations (hover, focus, active states)
  • Autonomous looping animations (spinners, pulses, attention grabbers)
  • Scroll-linked animations and parallax effects
  • Micro-interactions that don't need JavaScript control

When NOT to use:

  • Animations requiring JavaScript control (pause, reverse, seek) -- use Web Animations API
  • Complex orchestrated animations with staggered timing -- use your animation library
  • Physics-based spring animations -- use your animation library
  • Drag-and-drop or gesture-driven animations -- use your animation library

Detailed Resources:


<philosophy>

Philosophy

CSS animations leverage the browser's compositor thread for smooth, 60fps animations that don't block JavaScript execution. By animating only GPU-accelerated properties (transform and opacity), animations run on a separate thread from the main JavaScript thread.

Core principles:

  1. Performance first - Animate only transform and opacity to avoid layout/paint triggers
  2. Accessibility built-in - Always respect prefers-reduced-motion user preferences
  3. Transitions for state changes - Use CSS transitions for hover, focus, and state-driven animations
  4. Keyframes for autonomous motion - Use @keyframes for animations that loop, auto-play, or have multiple steps
  5. Design tokens for consistency - Use CSS custom properties for durations, easings, and distances

</philosophy>


<patterns>

Core Patterns

Pattern 1: Animation Token System

Define timing, easing, and distance tokens as CSS custom properties for consistency. See examples/core.md for the full token setup.

:root {
  --duration-instant: 100ms;
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;

  --ease-out: cubic-bezier(0, 0, 0.2, 1); /* Enter */
  --ease-in: cubic-bezier(0.4, 0, 1, 1); /* Exit */
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1); /* Symmetric */
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Bouncy */

  --lift-sm: -2px;
  --lift-md: -4px;
}

Why tokens matter: Consistent timing across application, easy to adjust globally, semantic naming communicates intent


Pattern 2: GPU-Accelerated Transitions

Only animate transform and opacity. Never animate layout properties like width, height, top, left, margin, or padding.

/* CORRECT - GPU-accelerated */
.card {
  transition:
    transform var(--duration-fast) var(--ease-out),
    opacity var(--duration-fast) var(--ease-out);
}
.card:hover {
  transform: translateY(var(--lift-md)) scale(1.02);
}
/* WRONG - triggers layout recalculation every frame */
.card {
  transition: all 0.3s linear;
}
.card:hover {
  top: -8px;
  margin-top: -8px;
}

Transform mapping: Use translate() instead of top/left, scale() instead of width/height, pseudo-element opacity instead of box-shadow.

See examples/core.md for button states, card hover effects, and the pseudo-element shadow technique.


Pattern 3: Prefers-Reduced-Motion

Every animation must respect user motion preferences. Two strategies:

Progressive Enhancement (Recommended)

/* Base: no motion */
.element {
  opacity: 1;
  transform: translateY(0);
}

/* Opt-in to motion */
@media (prefers-reduced-motion: no-preference) {
  .element {
    animation: fade-slide-in var(--duration-normal) var(--ease-out);
  }
}

Graceful Degradation

.notification {
  animation: slide-in-bounce var(--notification-duration) var(--ease-spring);
}

@media (prefers-reduced-motion: reduce) {
  .notification {
    animation: fade-in calc(var(--notification-duration) * 0.5) var(--ease-out);
  }
}

Key insight: Reduced motion does not mean no animation. Opacity fades are generally safe. Replace spatial movement with opacity-only alternatives.

See examples/core.md for the complete reduced motion pattern.


Pattern 4: CSS @keyframes

Use @keyframes for animations that loop, auto-play on mount, or have more than two states.

@keyframes fade-slide-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal {
  --modal-enter-duration: 300ms;
  animation: fade-slide-in var(--modal-enter-duration) var(--ease-out) forwards;
}

Key details:

  • Use forwards fill mode to retain final state after animation
  • Use backwards fill mode to show initial state during animation-delay
  • Use ease-out for enter, ease-in for exit
  • linear is only appropriate for continuous rotation (spinners)

See examples/core.md for spinners, pulses, skeleton loaders, and toast animations. See examples/keyframes.md for scroll-driven animations, @property gradients, and complex sequences.


Pattern 5: Will-Change Optimization

will-change creates a GPU layer (~307KB per 320x240px element). Apply only when needed, remove after.

/* CORRECT - only during interaction */
.card:hover {
  will-change: transform;
}

/* WRONG - permanent GPU layer on every element */
* {
  will-change: transform;
}

Never apply will-change permanently. Each element with will-change creates a separate compositing layer that consumes GPU memory. On mobile devices, this can crash the browser.


Pattern 6: Scroll-Driven Animations

CSS animation-timeline allows scroll-linked animations without JavaScript.

.progress-bar {
  animation: grow-width linear;
  animation-timeline: scroll();
}

@keyframes grow-width {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

Two timeline types:

  • scroll() -- progress based on scroll container position
  • view() -- progress based on element visibility in viewport

Browser support: Chrome/Edge 115+, Safari 26+, Firefox behind flag

See examples/keyframes.md for scroll progress, viewport reveal, and parallax patterns.


Pattern 7: @property for Custom Property Animation

CSS Houdini's @property enables animating custom properties like gradient angles that CSS cannot normally interpolate.

@property --gradient-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

.gradient-border {
  background: linear-gradient(var(--gradient-angle), #ff0080, #7928ca);
  animation: rotate-gradient 3s linear infinite;
}

@keyframes rotate-gradient {
  to {
    --gradient-angle: 360deg;
  }
}

Browser support: Chrome/Edge 85+, Safari 16.4+, Firefox 128+

</patterns>


<performance>

Performance

The 16.67ms Budget

For 60fps, each frame must complete in 16.67ms. Layout-triggering animations often exceed this budget.

Category Properties Impact
Composite only (Best) transform, opacity No layout, no paint, GPU-accelerated
Paint only (Okay) color, background-color, visibility No layout, but repaints
Layout + Paint (Avoid) width, height, margin, padding, top, left Full page recalculation

Duration Guidelines

Animation Type Duration Reason
Micro-interactions 100-150ms Feels instant
UI transitions 200-300ms Sweet spot for perception
Page transitions 300-500ms Major context change
Complex sequences 500-1000ms Story-telling moments

Transform Mapping

Instead of... Use...
top, left translate(x, y)
width, height scale()
box-shadow Pseudo-element with opacity
margin, padding translate() with layout space

</performance>


<decision_framework>

Decision Framework

Transitions vs @keyframes

Is the animation triggered by user interaction (hover, focus, class toggle)?
├─ YES → Is it a simple A->B state change?
│   ├─ YES -> CSS Transition
│   └─ NO -> Does it need multiple steps?
│       ├─ YES -> CSS @keyframes
│       └─ NO -> CSS Transition is fine
└─ NO -> Does it auto-play or loop?
    ├─ YES -> CSS @keyframes
    └─ NO -> CSS Transition (triggered by class toggle)

Easing Selection

What type of motion?
├─ Element entering -> ease-out (fast start, slow end)
├─ Element exiting -> ease-in (slow start, fast end)
├─ Symmetric motion -> ease-in-out
├─ Continuous rotation -> linear
├─ Playful/bouncy -> custom cubic-bezier with overshoot
└─ Default UI -> ease-out

Never use:
├─ linear for UI transitions (feels robotic)
└─ ease (browser default) for production (too generic)

CSS vs JavaScript Animation

Does the animation need...
├─ Pause/play/reverse/seek control? -> JavaScript (Web Animations API)
├─ Dynamic values calculated at runtime? -> JavaScript or CSS custom properties
├─ Physics-based springs? -> Your animation library
├─ Orchestrated staggering across many elements? -> JavaScript for complex, CSS for simple
├─ Scroll-linked progress? -> CSS scroll-driven animations
├─ Page/view transitions? -> See the View Transitions skill
└─ Simple state transitions? -> CSS Transitions

</decision_framework>


<red_flags>

RED FLAGS

High Priority

  • Animating layout properties (width, height, top, left, margin, padding) -- triggers expensive reflows every frame; use transform instead
  • Magic numbers for timing (0.3s, 300ms inline) -- all durations must be CSS custom properties
  • Missing prefers-reduced-motion -- every animation must respect user preferences
  • Linear easing for UI transitions -- linear feels robotic; use ease-out for enter, ease-in for exit
  • Permanent will-change -- creates GPU layers permanently, wasting memory; apply only during animation

Medium Priority

  • Using transition: all -- transitions unnecessary properties, causes surprises when new properties are added
  • Animating box-shadow directly -- causes repaint every frame; use pseudo-element with opacity
  • Missing forwards on enter animations -- element snaps back to initial state
  • Very long durations (>1s) -- users perceive as slow; rarely appropriate outside special effects

Gotchas & Edge Cases

  • transform + position: fixed -- transform creates new containing block, breaking fixed positioning relative to viewport
  • will-change creates stacking context -- can affect z-index behavior unexpectedly
  • Cannot animate display: none -- use opacity + visibility or grid-template-rows: 0fr
  • fill-mode: backwards needed for delayed animations -- without it, element shows in final state during delay
  • SVG uses different properties -- animate stroke-dashoffset and stroke-dasharray, not transform for path drawing
  • Scroll-driven animations need scrollable container -- overflow: hidden parent breaks scroll-timeline
  • Print media -- animations don't print; ensure content is visible without animation

</red_flags>


<critical_reminders>

CRITICAL REMINDERS

All code must follow project conventions in CLAUDE.md

(You MUST animate ONLY transform and opacity for GPU-accelerated 60fps performance)

(You MUST respect prefers-reduced-motion using @media (prefers-reduced-motion: no-preference) for opt-in or @media (prefers-reduced-motion: reduce) for opt-out)

(You MUST use CSS custom properties for ALL timing values - NO magic numbers like 0.3s)

(You MUST use ease-out for enter animations and ease-in for exit animations - NEVER linear for UI transitions)

(You MUST remove will-change after animation completes - permanent will-change wastes GPU memory)

Failure to follow these rules will cause jank, accessibility issues, and degraded user experience.

</critical_reminders>