Communitygithub.com

アニメーション&モーションスキル

CSSアニメーション、トランジション、スクロール駆動のエフェクトをアクセシビリティ(prefers-reduced-motion)に配慮して実装します。モーション、ホバーエフェクト、ローディング状態、スクロールベースのアニメーションを追加する際に使用します。

アニメーション&モーションスキル とは?

このスキルは、CSSアニメーションとトランジションに関する包括的な知識を提供し、アクセシビリティ(ユーザーの動きの設定を尊重)とパフォーマンス(ジャンクやレイアウトスラッシングの回避)に重点を置いています。主に、`prefers-reduced-motion`メディアクエリを使用して、動きを好まないユーザーには静的な状態をデフォルトとし、動きを好むユーザーにのみアニメーションを追加する「Reduced Motion First」アプローチを推奨します。また、パフォーマンスを考慮したアニメーション可能なプロパティ(transform、opacity、filter)の選択、will-changeの適切な使用、エントランスアニメーション、マイクロインタラクション、スケルトンローディングなど、さまざまなアニメーションパターンをカバーしています。さらに、視覚遷移API(View Transitions API)やスクロール駆動アニメーションなどの最新CSS機能にも対応しており、前庭性障害や発作を引き起こす可能性のある危険なパターン(パララックス、無限アニメーション、点滅など)を避けるためのガイドラインも含まれています。このスキルは、Claude CodeやCursorなどのAIエージェントが、アクセシブルでパフォーマンスの高いWebアニメーションを生成するために使用できます。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/David-Li0406/meta-skill-evloving/tree/HEAD/skill-flow/data/skills-refined-36k/skillsmp/animation-motion

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

アニメーション&モーションスキル は何をしますか?

このスキルは、CSSアニメーションとトランジションを、アクセシビリティ(ユーザーの動きの設定を尊重)とパフォーマンス(ジャンクやレイアウトスラッシングの回避)に重点を置いてカバーします。

関連: JavaScriptを使わないCSSのみのインタラクティブパターン(タブ、アコーディオン、トグル)については、progressive-enhancement スキルを参照してください。

理念

モーションは以下のようにあるべきです:

  1. 目的的 - 注意を誘導し、関係性を示し、フィードバックを提供する
  2. 尊重する - prefers-reduced-motion の設定を尊重する
  3. 高性能 - 可能な限りコンポジターのみのプロパティを使用する
  4. 控えめ - 強化するものであり、邪魔したり圧倒したりしない

動きを減らすことを優先

常に動きを減らした状態をデフォルトとし、オプトアウトしていないユーザーにのみ動きを追加します。

パターン

/* 基本: 動きなし(動きを減らすデフォルト) */
.element {
  transition: none;
}

/* ユーザーが動きの削減を要求していない場合のみ動きを追加 */
@media (prefers-reduced-motion: no-preference) {
  .element {
    transition: transform 0.3s ease, opacity 0.3s ease;
  }
}

なぜ動きを減らすことを優先するのか?

アプローチ問題点
動きを優先し、後で削除メディアクエリが適用される前に、ユーザーが動きのフラッシュを目にする
動きを減らして優先し、後で追加安全なデフォルト、動きはプログレッシブエンハンスメント

ユーザー設定の尊重

prefers-reduced-motion メディアクエリ

/* ユーザーが動きの削減を好む場合 */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

粒度の細かい動きの削減

すべての動きを削除する代わりに、代替案を提供します:

/* 設定のないユーザー向けのフルアニメーション */
@media (prefers-reduced-motion: no-preference) {
  .card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
  }

  .card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
  }
}

/* 動きを減らすユーザー向けの控えめな代替案 */
@media (prefers-reduced-motion: reduce) {
  .card {
    transition: box-shadow 0.15s ease;
  }

  .card:hover {
    box-shadow: var(--shadow-md);
  }
}

JavaScriptでの検出

const prefersReducedMotion = window.matchMedia(
  '(prefers-reduced-motion: reduce)'
).matches;

if (prefersReducedMotion) {
  // 即時トランジションを使用するか、アニメーションをスキップ
  element.style.transition = 'none';
} else {
  // フルアニメーション
  element.animate(keyframes, options);
}

パフォーマンスに安全なプロパティ

コンポジターのみのプロパティ(高速)

これらのプロパティは、レイアウトやペイントをトリガーせずにアニメーション化できます:

プロパティ使用目的
transform移動、拡大縮小、回転
opacityフェードイン/アウト
filterぼかし、明るさ(GPU加速)
/* GOOD: コンポジターのみ */
.card:hover {
  transform: translateY(-4px) scale(1.02);
  opacity: 0.9;
}

アニメーション化を避けるべきプロパティ

これらは高コストなレイアウト再計算をトリガーします:

プロパティ問題点
width, heightレイアウト再計算
top, left, right, bottomレイアウト再計算
margin, paddingレイアウト再計算
border-widthレイアウト再計算
font-sizeレイアウト + テキスト再フロー
/* BAD: レイアウトをトリガー */
.card:hover {
  margin-top: -4px;  /* レイアウトスラッシング */
  height: 110%;      /* レイアウトスラッシング */
}

/* GOOD: 代わりにtransformを使用 */
.card:hover {
  transform: translateY(-4px) scaleY(1.1);
}

コンポジターレイヤーへのプロモーション

既知のアニメーションには、控えめに will-change を使用します:

/* アニメーションする要素にのみ使用 */
.animated-element {
  will-change: transform, opacity;
}

/* アニメーション完了後に削除 */
.animated-element.animation-done {
  will-change: auto;
}

警告: 多くの要素に will-change を適用しないでください。メモリを消費します。


トランジションパターン

デザイントークンの統合

:root {
  /* 期間のスケール */
  --duration-instant: 0.1s;
  --duration-fast: 0.15s;
  --duration-normal: 0.3s;
  --duration-slow: 0.5s;

  /* イージング関数 */
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

一般的なトランジション

/* ホバーリフト効果 */
@media (prefers-reduced-motion: no-preference) {
  .card {
    transition:
      transform var(--duration-fast) var(--ease-out),
      box-shadow var(--duration-fast) var(--ease-out);
  }

  .card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
  }
}

/* フォーカスリング */
@media (prefers-reduced-motion: no-preference) {
  button {
    transition: outline-offset var(--duration-instant) var(--ease-out);
  }

  button:focus-visible {
    outline: 2px solid var(--focus-color);
    outline-offset: 2px;
  }
}

/* フェードイン */
@media (prefers-reduced-motion: no-preference) {
  .fade-in {
    animation: fadeIn var(--duration-normal) var(--ease-out);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

アニメーションパターン

キーフレームアニメーション

/* 注意を引くための控えめなパルス */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@media (prefers-reduced-motion: no-preference) {
  .notification-badge {
    animation: pulse 2s var(--ease-in-out) infinite;
  }
}

/* 動きを減らす場合の代替案: アニメーションなし */
@media (prefers-reduced-motion: reduce) {
  .notification-badge {
    animation: none;
  }
}

ローディングスピナー

/* 動きの削減を尊重するスピナー */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
}

@media (prefers-reduced-motion: no-preference) {
  .spinner {
    animation: spin 1s linear infinite;
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    /* 静的インジケーターまたはパルス不透明度 */
    animation: none;
    border-style: dotted;
  }
}

スケルトンローディング

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-color) 25%,
    var(--background-alt) 50%,
    var(--surface-color) 75%
  );
  background-size: 200% 100%;
}

@media (prefers-reduced-motion: no-preference) {
  .skeleton {
    animation: shimmer 1.5s infinite;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
    background: var(--background-alt);
  }
}

エントランスアニメーション

フェードとスライド

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .animate-in {
    animation: fadeSlideUp var(--duration-normal) var(--ease-out) both;
  }

  /* 子要素のスタガー */
  .animate-in > * {
    animation: fadeSlideUp var(--duration-normal) var(--ease-out) both;
  }

  .animate-in > *:nth-child(1) { animation-delay: 0ms; }
  .animate-in > *:nth-child(2) { animation-delay: 50ms; }
  .animate-in > *:nth-child(3) { animation-delay: 100ms; }
  .animate-in > *:nth-child(4) { animation-delay: 150ms; }
}

@media (prefers-reduced-motion: reduce) {
  .animate-in,
  .animate-in > * {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

スケールイン

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: no-preference) {
  dialog[open] {
    animation: scaleIn var(--duration-fast) var(--ease-out);
  }
}

View Transitions API

ページ遷移用(プログレッシブエンハンスメント):

/* ビュー遷移を有効化 */
@view-transition {
  navigation: auto;
}

/* デフォルトのクロスフェード */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: var(--duration-normal);
}

/* 動きの削減を尊重 */
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 0.01ms;
  }
}

/* 特定要素向けの名前付き遷移 */
.hero-image {
  view-transition-name: hero;
}

::view-transition-old(hero),
::view-transition-new(hero) {
  animation-duration: var(--duration-slow);
}

スクロール駆動アニメーション

モダンCSSのスクロール駆動アニメーション(プログレッシブエンハンスメント):

/* スクロールに応じてフェードイン */
@keyframes fadeInOnScroll {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: no-preference) {
  .scroll-reveal {
    animation: fadeInOnScroll linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-reveal {
    opacity: 1;
    transform: none;
  }
}

マイクロインタラクション

ボタンプレス

@media (prefers-reduced-motion: no-preference) {
  button {
    transition: transform var(--duration-instant) var(--ease-out);
  }

  button:active {
    transform: scale(0.98);
  }
}

トグルスイッチ

.toggle-track {
  width: 44px;
  height: 24px;
  background: var(--surface-color);
  border-radius: 12px;
}

.toggle-thumb {
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transform: translateX(2px);
}

@media (prefers-reduced-motion: no-preference) {
  .toggle-thumb {
    transition: transform var(--duration-fast) var(--ease-out);
  }
}

.toggle-input:checked + .toggle-track .toggle-thumb {
  transform: translateX(22px);
}

チェックボックスのチェック

.checkbox-icon {
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
}

@media (prefers-reduced-motion: no-preference) {
  .checkbox-icon {
    transition: stroke-dashoffset var(--duration-fast) var(--ease-out);
  }
}

.checkbox-input:checked + .checkbox-box .checkbox-icon {
  stroke-dashoffset: 0;
}

アニメーション期間のガイドライン

アニメーションタイプ期間理由
マイクロインタラクション100-150ms即時フィードバック
シンプルなトランジション150-300ms気づく程度で素早い
複雑なアニメーション300-500ms追従する時間
ページ遷移300-500msコンテキストの切り替え
ローディングインジケーター1000-2000ms1周期を確認可能

100msルール

ユーザーは、応答が100ms未満の場合、アクションを瞬時に行われたと認識します。これは以下に使用します:

  • ボタンのアクティブ状態
  • フォーカスインジケーター
  • トグルスイッチ

避けるべき危険なパターン

前庭性トリガー

これらは乗り物酔いや発作を引き起こす可能性があります:

パターン問題点代替案
パララックススクロール前庭系の問題静的または控えめなパララックス
自動再生ビデオ予期しない動きインタラクション時に再生
点滅(3Hz超)発作のリスク点滅なし
大規模なズーム前庭系の問題フェードトランジション
回転/旋回方向感覚の喪失フェードまたはスライド
/* BAD: アグレッシブなパララックス */
.parallax {
  transform: translateY(calc(var(--scroll) * 0.5));
}

/* BETTER: 動きの削減で控えめにするか無効化 */
@media (prefers-reduced-motion: reduce) {
  .parallax {
    transform: none;
  }
}

無限アニメーション

/* BAD: 絶え間ない動き */
.attention-seeker {
  animation: bounce 1s infinite;
}

/* BETTER: 反復回数の制限 */
.attention-seeker {
  animation: bounce 1s 3; /* 3回のみ */
}

/* BEST: インタラクションでトリガー */
.attention-seeker:hover {
  animation: bounce 0.5s;
}

テストチェックリスト

ブラウザDevTools

  1. Chrome: Rendering > Emulate CSS media feature > prefers-reduced-motion: reduce
  2. Firefox: about:config > ui.prefersReducedMotion (0=no-preference, 1=reduce)
  3. Safari: Develop > Experimental Features > Reduced Motion

システム設定

  • macOS: システム環境設定 > アクセシビリティ > 表示 > 動きを減らす
  • iOS: 設定 > アクセシビリティ > 動作 > 動きを減らす
  • Windows: 設定 > 簡単操作 > ディスプレイ > アニメーションを表示する
  • Android: 設定 > アクセシビリティ > アニメーションを削除

チェックリスト

アニメーションやトランジションを追加する際:

  • prefers-reduced-motion が尊重されている
  • 動きを減らす場合に意味のある代替案がある(単に無効にするだけではない)
  • アニメーション化するプロパティはコンポジターのみ(transform、opacity)
  • will-change は控えめに使用され、アニメーション後に削除される
  • 期間トークンが一貫して使用されている
  • 点滅するコンテンツがない(1秒あたり3回以上の点滅)
  • 無限アニメーションには目的があり、停止できる
  • パララックスや大きな動きはオプションの強化機能である
  • ローディング状態がアニメーションなしでも機能する
  • アニメーションが邪魔にならず、むしろ強化している

関連スキル

  • css-author - ネイティブの@import、@layerカスケードを使用したモダンCSSの構成
  • progressive-enhancement - CSSのみのインタラクティブパターンを使用したHTMLファースト開発
  • performance - パフォーマンスに優れたHTMLページの作成
  • accessibility-checker - WCAG2AAアクセシビリティ準拠の確認

Individual skills in this repo

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

David-Li0406/meta-skill-evloving

Browser automation with persistent page state. Use when users ask to navigate websites, fill forms, take screenshots, extract web data, test web apps, or automate browser workflows. Trigger phrases include "go to [url]", "click on", "fill out the form", "take a screenshot", "scrape", "automate", "test the website", "log into", or any browser interaction request.

David-Li0406/meta-skill-evloving

Create technical diagrams using Mermaid syntax for architecture, sequences, ERDs, flowcharts, and state machines. Use for visualizing system design, data flows, and processes. Triggers: diagram, mermaid, architecture diagram, sequence diagram, flowchart, ERD, entity relationship, state diagram, C4 model, component diagram, visualize, draw.

David-Li0406/meta-skill-evloving

Comprehensive document creation, editing, and analysis with support for tracked changes, comments, formatting preservation, and text extraction. When Claude needs to work with professional documents (.docx files) for: (1) Creating new documents, (2) Modifying or editing content, (3) Working with tracked changes, (4) Adding comments, or any other document tasks

David-Li0406/meta-skill-evloving

Complete color manipulation and green screen effects system. PROACTIVELY activate for: (1) Green screen/chromakey removal, (2) Color grading with LUTs, (3) Color correction (levels, curves, white balance), (4) Colorkey/color removal effects, (5) Hue/saturation manipulation, (6) Color space conversions (BT.709, BT.2020, HDR), (7) Color isolation effects, (8) Teal and orange look, (9) Vintage/film looks, (10) Color keying for transparency. Provides: chromakey and colorkey filters, LUT application (lut3d), curves and levels adjustment, color balance, selective color manipulation, color space handling, HDR tone mapping, professional color grading chains.

David-Li0406/meta-skill-evloving

Convert files and office documents to Markdown. Supports PDF, DOCX, PPTX, XLSX, images (with OCR), audio (with transcription), HTML, CSV, JSON, XML, ZIP, YouTube URLs, EPubs and more.

David-Li0406/meta-skill-evloving

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

David-Li0406/meta-skill-evloving

Build with OpenAI's stateless APIs - Chat Completions (GPT-5, GPT-4o), Embeddings, Images (DALL-E 3), Audio (Whisper + TTS), and Moderation. Includes Node.js SDK and fetch-based approaches for Cloudflare Workers. Use when: implementing chat completions with GPT-5/GPT-4o, streaming responses with SSE, using function calling/tools, creating structured outputs with JSON schemas, generating embeddings for RAG (text-embedding-3-small/large), generating images with DALL-E 3, editing images with GPT-Image-1, transcribing audio with Whisper, synthesizing speech with TTS (11 voices), moderating content (11 safety categories), or troubleshooting rate limits (429), invalid API keys (401), function calling failures, streaming parse errors, embeddings dimension mismatches, or token limit exceeded.

David-Li0406/meta-skill-evloving

Comprehensive PDF manipulation toolkit for extracting text and tables, creating new PDFs, merging/splitting documents, and handling forms. When Claude needs to fill in a PDF form or programmatically process, generate, or analyze PDF documents at scale.

David-Li0406/meta-skill-evloving

Presentation creation, editing, and analysis. When Claude needs to work with presentations (.pptx files) for: (1) Creating new presentations, (2) Modifying or editing content, (3) Working with layouts, (4) Adding comments or speaker notes, or any other presentation tasks

David-Li0406/meta-skill-evloving

Comprehensive spreadsheet creation, editing, and analysis with support for formulas, formatting, data analysis, and visualization. When Claude needs to work with spreadsheets (.xlsx, .xlsm, .csv, .tsv, etc) for: (1) Creating new spreadsheets with formulas and formatting, (2) Reading or analyzing data, (3) Modify existing spreadsheets while preserving formulas, (4) Data analysis and visualization in spreadsheets, or (5) Recalculating formulas

David-Li0406/meta-skill-evloving

Download YouTube videos with customizable quality and format options. Use this skill when the user asks to download, save, or grab YouTube videos. Supports various quality settings (best, 1080p, 720p, 480p, 360p), multiple formats (mp4, webm, mkv), and audio-only downloads as MP3.

David-Li0406/meta-skill-evloving

Best practices for Remotion - Video creation in React

David-Li0406/meta-skill-evloving

Provides bidirectional translation (Chinese/English), grammar checking, and sentence polishing. Supports specific tense constraints, context-aware tone adjustment, and natural expression optimization. Outputs direct text without formatting.

David-Li0406/meta-skill-evloving

指导如何通过自定义注解(如@Unicom)标识Dubbo接口,利用BeanDefinitionRegistryPostProcessor在启动时扫描并动态注册ReferenceBean,实现RPC调用的封装。

David-Li0406/meta-skill-evloving

生成Python脚本,利用FFmpeg将图片序列按3x3布局合并,或将合并图拆分。要求使用subprocess模块执行命令,并支持用户交互式输入路径。

David-Li0406/meta-skill-evloving

SOP for extracting and analyzing promotional activity details, handling time formatting, location mapping, payment logic, and step-by-step process validation.

David-Li0406/meta-skill-evloving

Specializes in creating TikTok short video scripts using an anthropomorphic 'Chef' perspective to explain wildlife food chains and survival environments, utilizing real field footage.

David-Li0406/meta-skill-evloving

针对TikTok平台,以拟人化视角(如动物作为厨师)创作系列短视频脚本。重点介绍野生动物、食物链及生态环境,要求使用野外实拍素材,风格幽默且具有教育意义。

David-Li0406/meta-skill-evloving

Generates KWL (Know, Want to know, Learned) charts for educational videos, specifically BrainPOP, using simple 7th-grade language and short, concise bullet points.

David-Li0406/meta-skill-evloving

Tracks complex, multi-session work using the Beads issue tracker and dependency graphs, and provides persistent memory that survives conversation compaction. Use when work spans multiple sessions, has complex dependencies, or needs persistent context across compaction cycles. Trigger with phrases like "create task for", "what's ready to work on", "show task", "track this work", "what's blocking", or "update status".

関連スキル