Communitygithub.com

ASoudy/AGS

审计并修复动画性能问题,包括布局抖动、合成器属性、滚动驱动动画和模糊效果。在动画卡顿、过渡不畅或审查 CSS/JS 动画性能时使用。

AGS 是什么?

这是一个专注于网页动画性能审计与修复的 AI 代理技能。它能识别并帮助修复包括布局抖动、滚动驱动动画、频繁绘画(重绘)以及模糊滤镜在内的各类性能问题。该技能提供了清晰的规则分类(按优先级从“绝不模式”到“工具边界”)和直观的快速参考,以及具体的 CSS/JS 代码修复示例。它支持在 Claude Code 等 AI 编码工具中使用,通过文档级联的方式指导开发者选择最合适的动画机制(偏向使用 transform 和 opacity),避免性能陷阱。其核心是帮助开发者在保持代码库现有架构的前提下,生成更流畅、更高效的动画实现。

兼容平台~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 或尺寸测量的组件

渲染步骤术语表

  • composite(合成):transform、opacity
  • paint(绘制):color、borders、gradients、masks、images、filters
  • layout(布局):size、position、flow、grid、flex

按优先级分类的规则类别

优先级类别影响
1绝不模式严重
2选择机制严重
3测量高
4滚动高
5绘制中高
6层中
7模糊与滤镜中
8视图过渡低
9工具边界严重

快速参考

1. 绝不模式(严重)

  • 不要在同一帧中交替进行布局读取和写入
  • 不要在大型或有意义的表面上持续动画化布局
  • 不要通过 scrollTop、scrollY 或 scroll 事件驱动动画
  • 没有停止条件的 requestAnimationFrame 循环禁止使用
  • 不要混合使用多种各自会测量或更改布局的动画系统

2. 选择机制(严重)

  • 默认使用 transform 和 opacity 进行动画
  • 仅在交互需要时使用 JS 驱动的动画
  • 仅允许在小型、独立的表面上进行 paint(绘制)或 layout(布局)动画
  • 一次性效果比连续动画更可接受
  • 优先选择降级技术而非完全移除动画

3. 测量(高)

  • 测量一次,然后通过 transform 或 opacity 进行动画
  • 在写入之前,批量执行所有 DOM 读取操作
  • 在动画期间不要重复读取布局
  • 对于类似布局的效果,优先使用 FLIP 风格的过渡
  • 优先选择能批量处理测量和写入的方法

4. 滚动(高)

  • 在可能的情况下,优先使用 Scroll 或 View Timeline 来实现滚动驱动的动画
  • 使用 IntersectionObserver 来检测可见性和暂停动画
  • 不要轮询滚动位置来进行动画
  • 当元素不可见时,暂停或停止动画
  • 滚动驱动的动画不得在大型表面上触发持续的布局或绘制

5. 绘制(中高)

  • 仅允许在小型、独立的元素上进行触发 paint(绘制)的动画
  • 不要在大容器上对 paint 密集型属性进行动画
  • 不要为 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.

相关技能