Communitygithub.com

モーション・パフォーマンス修正

レイアウトスラッシング、コンポジタプロパティ、スクロール連動モーション、ぼかし効果など、アニメーションのパフォーマンス問題を監査・修正します。アニメーションがカクつく、トランジションがぎこちない、CSS/JSのアニメーションパフォーマンスをレビューする際に使用します。

モーション・パフォーマンス修正 とは?

このスキルは、UIアニメーションのパフォーマンス問題を診断・修正するための包括的なガイドラインを提供します。「絶対禁止パターン」「メカニズムの選択」「測定」「スクロール」「ペイント」「レイヤー」「ぼかしとフィルター」「ビュートランジション」「ツール境界」の9つのカテゴリに優先順位を付けてまとめており、critical(重大)からlow(低)までの影響度を明確にしています。具体的な修正例として、CSSの`width`アニメーションを`transform`に変更する方法や、JavaScriptのスクロールイベントを`scroll-timeline`に置き換える方法をコード付きで提示します。また、レイアウトスラッシングを避けるためのFLIP手法や、`will-change`の適切な使用法もカバーしています。Claude Code, Cursor, CodexなどのAIエージェントツールで動作し、既存のアニメーションライブラリを変更せずに、現在のスタック内でルールを適用することを推奨します。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/AbobakrDiara61/railway-system/tree/HEAD/frontend/skills/fixing-motion-performance

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

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

ドキュメント

モーション・パフォーマンス修正 は何をしますか?

アニメーションのパフォーマンス問題を修正します。

使い方

  • /fixing-motion-performance この会話内のすべてのUIアニメーション作業に以下の制約を適用します。

  • /fixing-motion-performance <ファイル> ファイルを以下のすべてのルールに照らしてレビューし、以下を報告します。

    • 違反内容(該当する行またはスニペットを引用)
    • なぜ問題か(簡潔な一文)
    • 具体的な修正(コードレベルの提案)

明示的に要求されない限り、アニメーションライブラリを移行しないでください。既存のスタック内でルールを適用します。

使用するタイミング

以下の場合にこれらのガイドラインを参照してください:

  • UIアニメーション(CSS、WAAPI、Motion、rAF、GSAP)を追加または変更する場合
  • ぎこちないインタラクションやトランジションをリファクタリングする場合
  • スクロール連動モーションやスクロールに応じた表示を実装する場合
  • レイアウト、フィルター、マスク、グラデーション、CSS変数をアニメーションさせる場合
  • will-change、transform、測定を使用するコンポーネントをレビューする場合

レンダリング手順の用語

  • コンポジット:transform、opacity
  • ペイント:色、ボーダー、グラデーション、マスク、画像、フィルター
  • レイアウト:サイズ、位置、フロー、グリッド、フレックス

優先順位別ルールカテゴリ

優先順位カテゴリ影響度
1絶対禁止パターンcritical
2メカニズムの選択critical
3測定high
4スクロールhigh
5ペイントmedium-high
6レイヤーmedium
7ぼかしとフィルターmedium
8ビュートランジションlow
9ツール境界critical

クイックリファレンス

1. 絶対禁止パターン(critical)

  • 同じフレーム内でレイアウトの読み取りと書き込みを交互に行わない
  • 大規模または重要な領域でレイアウトを継続的にアニメーションさせない
  • scrollTop、scrollY、またはスクロールイベントからアニメーションを駆動しない
  • 停止条件のないrequestAnimationFrameループを使用しない
  • それぞれがレイアウトを測定または変更する複数のアニメーションシステムを混在させない

2. メカニズムの選択(critical)

  • モーションにはデフォルトでtransformとopacityを使用する
  • インタラクションで必要な場合のみ、JS駆動のアニメーションを使用する
  • ペイントまたはレイアウトのアニメーションは、小さく独立した領域でのみ許容される
  • 単発のエフェクトは連続モーションよりも許容されやすい
  • モーションを完全に削除するよりも、手法をダウングレードすることを優先する

3. 測定(high)

  • 一度測定したら、transformまたはopacityでアニメーションさせる
  • すべてのDOM読み取りを書き込み前にバッチ処理する
  • アニメーション中にレイアウトを繰り返し読み取らない
  • レイアウト風のエフェクトにはFLIPスタイルのトランジションを優先する
  • 測定と書き込みをバッチ処理するアプローチを優先する

4. スクロール(high)

  • スクロール連動モーションには、利用可能な場合はScrollまたはView Timelinesを優先する
  • 可視性と一時停止にはIntersectionObserverを使用する
  • アニメーションのためにスクロール位置をポーリングしない
  • 画面外ではアニメーションを停止または一時停止する
  • スクロール連動モーションは、大規模な領域で継続的なレイアウトやペイントを引き起こしてはならない

5. ペイント(medium-high)

  • ペイントをトリガーするアニメーションは、小さく独立した要素でのみ許可される
  • 大きなコンテナでペイント負荷の高いプロパティをアニメーションさせない
  • transform、opacity、または位置のためにCSS変数をアニメーションさせない
  • 継承されたCSS変数をアニメーションさせない
  • アニメーションさせるCSS変数はローカルにスコープし、継承を避ける

6. レイヤー(medium)

  • コンポジタモーションにはレイヤー昇格が必要であり、自動で行われると想定しない
  • will-changeは一時的かつ限定的に使用する
  • 多数または大規模な昇格レイヤーを避ける
  • パフォーマンスが重要な場合はツールを使用してレイヤーの動作を検証する

7. ぼかしとフィルター(medium)

  • ぼかしアニメーションは小さく(<=8px)保つ
  • ぼかしは短い単発エフェクトにのみ使用する
  • ぼかしを連続的にアニメーションさせない
  • 大きな領域でぼかしをアニメーションさせない
  • ぼかしよりもopacityとtranslateを優先する

8. ビュートランジション(low)

  • ビュートランジションはナビゲーションレベルの変更にのみ使用する
  • インタラクションの多いUIではビュートランジションを避ける
  • 中断やキャンセルが必要な場合、ビュートランジションを避ける
  • サイズ変更はレイアウトをトリガーする可能性があると見なす

9. ツール境界(critical)

  • 明示的に要求されない限り、アニメーションライブラリを移行または書き換えない
  • 既存のアニメーションシステム内でこれらのルールを適用する
  • 同じコンポーネント内でAPIを部分的に移行したり、スタイルを混在させたりしない

よくある修正

/* レイアウトスラッシング:widthの代わりにtransformをアニメーション */
/* 修正前 */ .panel { transition: width 0.3s; }
/* 修正後 */  .panel { transition: transform 0.3s; }

/* スクロール連動:JSの代わりにscroll-timelineを使用 */
/* 修正前 */ window.addEventListener('scroll', () => el.style.opacity = scrollY / 500)
/* 修正後 */  .reveal { animation: fade-in linear; animation-timeline: view(); }
// 測定:書き込み前に読み取りをバッチ処理(FLIP)
// 修正前 — レイアウトスラッシング
el.style.left = el.getBoundingClientRect().left + 10 + 'px';
// 修正後 — 一度測定し、transformでアニメーション
const first = el.getBoundingClientRect();
el.classList.add('moved');
const last = el.getBoundingClientRect();
el.style.transform = `translateX(${first.left - last.left}px)`;
requestAnimationFrame(() => { el.style.transition = 'transform 0.3s'; el.style.transform = ''; });

レビューガイダンス

  • 最初にcriticalなルール(絶対禁止パターン、ツール境界)を適用する
  • 意図に合った最も負荷の低いレンダリング作業を選択する
  • デフォルト以外の選択をする場合は、それを正当化する制約(領域サイズ、期間、インタラクション要件)を明記する
  • レビュー時には、理論よりも実用的な指摘と具体的な代替案を優先する

制限事項

  • このスキルは、タスクが上記の範囲に明確に一致する場合にのみ使用してください。
  • 出力を環境固有の検証、テスト、専門家によるレビューの代わりとして扱わないでください。
  • 必要な入力、権限、安全境界、成功基準が不足している場合は、立ち止まって明確化を求めてください。

Individual skills in this repo

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

AbobakrDiara61/railway-system

Skill for discovering and researching autonomous AI agents, tools, and ecosystems using the AgentFolio directory.

AbobakrDiara61/railway-system

Advanced JavaScript animation library skill for creating complex, high-performance web animations.

AbobakrDiara61/railway-system

Astropy is the core Python package for astronomy, providing essential functionality for astronomical research and data analysis.

AbobakrDiara61/railway-system

One sentence - what this skill does and when to invoke it

AbobakrDiara61/railway-system

Internationalization and localization patterns. Detecting hardcoded strings, managing translations, locale files, RTL support.

AbobakrDiara61/railway-system

Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences. Covers developer portfolios, designer portfolios, creative portfolios, and portfolios that convert visitors into opportunities.

AbobakrDiara61/railway-system

Generates high-converting Next.js/React landing pages with Tailwind CSS. Uses PAS, AIDA, and BAB frameworks for optimized copy/components (Heroes, Features, Pricing). Focuses on Core Web Vitals/SEO.

AbobakrDiara61/railway-system

AI-powered animation tool for creating motion in logos, UI, icons, and social media assets.

AbobakrDiara61/railway-system

CRITICAL: Use for Makepad animation system. Triggers on: makepad animation, makepad animator, makepad hover, makepad state, makepad transition, "from: { all: Forward", makepad pressed, makepad 动画, makepad 状态, makepad 过渡, makepad 悬停效果

AbobakrDiara61/railway-system

Best practices for Remotion - Video creation in React

AbobakrDiara61/railway-system

Generate walkthrough videos from Stitch projects using Remotion with smooth transitions, zooming, and text overlays

AbobakrDiara61/railway-system

Seek and analyze video content using Memories.ai Large Visual Memory Model for persistent video intelligence

AbobakrDiara61/railway-system

Writes complete, structured landing pages optimized for SEO ranking, AEO citation, and visitor conversion. Activate when the user wants to write or generate a landing page for a product, service, or offer.

AbobakrDiara61/railway-system

Three.js animation - keyframe animation, skeletal animation, morph targets, animation mixing. Use when animating objects, playing GLTF animations, creating procedural motion, or blending animations.

AbobakrDiara61/railway-system

Automate TikTok tasks via Rube MCP (Composio): upload/publish videos, post photos, manage content, and view user profiles/stats. Always search tools first for current schemas.

AbobakrDiara61/railway-system

Video and audio perception, indexing, and editing. Ingest files/URLs/live streams, build visual/spoken indexes, search with timestamps, edit timelines, add overlays/subtitles, generate media, and create real-time alerts.

AbobakrDiara61/railway-system

Upload, stream, search, edit, transcribe, and generate AI video and audio using the VideoDB SDK.

AbobakrDiara61/railway-system

One sentence - what this skill does and when to invoke it

AbobakrDiara61/railway-system

Automate YouTube tasks via Rube MCP (Composio): upload videos, manage playlists, search content, get analytics, and handle comments. Always search tools first for current schemas.

AbobakrDiara61/railway-system

Extract transcripts from YouTube videos and generate comprehensive, detailed summaries using intelligent analysis frameworks

関連スキル