Communitygithub.com

ASoudy/AGS

審計與修復動畫效能問題,包含版面震盪、合成器屬性、滾輪驅動動畫及模糊效果。當動畫卡頓、轉場不流暢或需審查 CSS/JS 動畫效能時使用。

AGS 是什麼?

此技能主要協助開發者審計與修復 UI 動畫效能問題,遵循一套分級規則,從關鍵的「永不模式」到低優先級的「視圖轉換」皆涵蓋。它能自動偵測導致版面震盪、過度繪製或錯誤使用滾輪事件的程式碼,並提供具體的修正建議,例如改用 transform 與 opacity 動畫、批量測量 DOM、或使用 Scroll Timelines 取代 JavaScript 滾輪監聽。技能支援 CSS、WAAPI、Motion、requestAnimationFrame 及 GSAP 等常見動畫庫,適用於 Claude Code、Cursor 等開發工具。使用時,開發者可透過指令 `/fixing-motion-performance` 啟動約束,或針對特定檔案 `/fixing-motion-performance <file>` 進行審查,回報違規的確切程式碼、影響說明及修正方案,同時明確規範不應主動遷移動畫庫,除非被明確要求。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ASoudy/AGS/tree/HEAD/AGAS/plugins/antigravity-awesome-skills-claude/skills/fixing-motion-performance

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

修復動畫效能

修復動畫效能問題。

使用方法

  • /fixing-motion-performance 將這些約束套用到對話中所有 UI 動畫工作。

  • /fixing-motion-performance <file> 依據以下所有規則審查該檔案,並回報:

    • 違規(引用確切行數或程式碼片段)
    • 為什麼重要(一句簡短說明)
    • 具體修正(程式碼層級的建議)

除非明確要求,否則請勿遷移動畫庫。應在現有技術棧內套用規則。

使用時機

在以下情境參考這些指南:

  • 新增或修改 UI 動畫(CSS, WAAPI, Motion, rAF, GSAP)
  • 重構卡頓的互動或轉場
  • 實作滾輪驅動動畫或滾動顯現效果
  • 對版面、濾鏡、遮罩、漸層或 CSS 變數進行動畫
  • 審查使用了 will-change、變形或尺寸測量的元件

渲染步驟說明

  • 合成:transform, opacity
  • 繪製:color, borders, gradients, masks, images, filters
  • 版面:size, position, flow, grid, flex

規則類別(依優先級)

優先級類別影響程度
1永不模式嚴重
2選擇機制嚴重
3測量高
4滾輪高
5繪製中高
6圖層中
7模糊與濾鏡中
8視圖轉換低
9工具界限嚴重

快速參考

1. 永不模式(嚴重)

  • 禁止在同一個影格中交錯讀取與寫入版面屬性
  • 禁止在大型或有重要意義的表面上連續對版面屬性進行動畫
  • 禁止透過 scrollTop、scrollY 或 scroll 事件驅動動畫
  • 禁止使用沒有停止條件的 requestAnimationFrame 迴圈
  • 禁止混用多個各自測量或修改版面的動畫系統

2. 選擇機制(嚴重)

  • 預設使用 transform 和 opacity 進行動畫
  • 僅在互動需要時才使用 JS 驅動的動畫
  • 僅在小型、孤立的元素上允許繪製或版面動畫
  • 一次性效果比連續動畫更容易被接受
  • 優先選擇降級技術,而非完全移除動畫

3. 測量(高)

  • 測量一次,然後透過 transform 或 opacity 進行動畫
  • 在寫入之前批量完成所有 DOM 讀取
  • 動畫過程中不要重複讀取版面屬性
  • 偏好使用 FLIP 風格的轉換來實現類似版面的效果
  • 偏好能批量測量與寫入的方法

4. 滾輪(高)

  • 當支援時,優先使用 Scroll 或 View Timelines 實現滾輪驅動動畫
  • 使用 IntersectionObserver 判斷可見性與暫停
  • 不要輪詢滾動位置來驅動動畫
  • 當元素離開畫面時暫停或停止動畫
  • 滾輪驅動動畫不得在大型表面上觸發連續版面或繪製

5. 繪製(中高)

  • 僅允許在小型、孤立的元素上觸發繪製的動畫
  • 不要在大型容器上對繪製密集型屬性進行動畫
  • 不要對 transform、opacity 或 position 的 CSS 變數進行動畫
  • 不要對繼承的 CSS 變數進行動畫
  • 局部定義動畫用的 CSS 變數,避免繼承

6. 圖層(中)

  • 合成器動畫需要圖層提升,不要假設已自動提升
  • 暫時且精準地使用 will-change
  • 避免大量或大型的提升圖層
  • 當效能關鍵時,使用工具驗證圖層行為

7. 模糊與濾鏡(中)

  • 模糊動畫範圍保持小(<=8px)
  • 僅在短暫、一次性效果中使用模糊
  • 絕對不要對模糊進行連續動畫
  • 絕對不要在大型表面上對模糊進行動畫
  • 在模糊之前優先考慮 opacity 和 translate

8. 視圖轉換(低)

  • 僅在導航層級的變更中使用視圖轉換
  • 避免在需要頻繁互動的 UI 中使用視圖轉換
  • 當需要中斷或取消時避免視圖轉換
  • 將尺寸變更視為可能觸發版面的操作

9. 工具界限(嚴重)

  • 除非明確要求,否則不要遷移或重寫動畫庫
  • 在現有動畫系統內套用這些規則
  • 絕不部分遷移 API 或在同一個元件中混用樣式

常見修正

/* 版面震盪:改用 transform 而非 width 進行動畫 */
/* 修改前 */ .panel { transition: width 0.3s; }
/* 修改後 */  .panel { transition: transform 0.3s; }

/* 滾輪驅動:改用 scroll-timeline 而非 JS */
/* 修改前 */ 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 = ''; });

審查指引

  • 優先執行關鍵規則(永不模式、工具界限)
  • 選擇最符合意圖且渲染開銷最低的方式
  • 對於任何非預設的選擇,說明使其合理的約束條件(表面大小、時長或互動需求)
  • 審查時,偏好提供可操作的備註與具體替代方案,而非理論

限制

  • 僅在任務明確符合上述範圍時使用此技能。
  • 請勿將輸出視為環境特定驗證、測試或專家審查的替代方案。
  • 若缺少所需的輸入、權限、安全邊界或成功標準,請停下並請求釐清。

Individual skills in this repo

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

ASoudy/AGS

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

ASoudy/AGS

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

ASoudy/AGS

Build content-focused websites with Astro — zero JS by default, islands architecture, multi-framework components, and Markdown/MDX support.

ASoudy/AGS

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

ASoudy/AGS

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

ASoudy/AGS

Pull a YouTube video transcript into a queryable markdown vault with yt-dlp subtitle discovery, VTT cleanup, metadata frontmatter, and capture-seed stubs.

ASoudy/AGS

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.

ASoudy/AGS

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.

ASoudy/AGS

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

ASoudy/AGS

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 悬停效果

ASoudy/AGS

Comprehensive patterns for Next.js 14+ App Router architecture, Server Components, and modern full-stack React development.

ASoudy/AGS

Next.js App Router principles. Server Components, data fetching, routing patterns.

ASoudy/AGS

Expert integration of Supabase Auth with Next.js App Router

ASoudy/AGS

React and Next.js 14+ application development with App Router, Server Components, TypeScript, Tailwind CSS, and modern frontend patterns.

ASoudy/AGS

Best practices for Remotion - Video creation in React

ASoudy/AGS

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

ASoudy/AGS

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

ASoudy/AGS

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.

ASoudy/AGS

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

ASoudy/AGS

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

相關技能