Communitygithub.com

Anhvu1107/动画性能修复技能

在匹配“修复运动性能”请求时始终使用此技能:审核并修复动画性能问题,包括布局抖动、合成器属性、滚动关联运动和模糊效果。

动画性能修复技能 是什么?

此AI技能专门用于诊断和修复UI动画性能问题,涵盖布局抖动、合成器属性、滚动关联运动及模糊效果等常见瓶颈。它提供了从关键到低优先级的九条规则类别,包括禁止模式、机制选择、测量策略、滚动处理、绘制优化、层管理、模糊与滤镜、视图过渡及工具边界。技能支持CSS、WAAPI、Motion、requestAnimationFrame、GSAP等多种动画技术,并强调优先使用transform和opacity进行合成器动画,避免布局触发性动画。它还包含选择性阅读规则,以高效加载相关文档,以及常见修复示例和审核指南,帮助开发者识别违规、理解影响并提供代码级建议。此技能适用于添加或更改UI动画、重构卡顿交互、实现滚动关联运动以及审核使用will-change、transform或测量的组件。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Anhvu1107/all-agent-skill/tree/HEAD/.agent/skills/fixing-motion-performance

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

修复运动性能

选择性阅读规则

从以下文件开始:

  • references/senior-master-standard.md
  • references/usage-routing.md
  • references/quality-checklist.md

然后仅加载与用户实际任务匹配的继承文档、脚本、资源或示例。

修复动画性能问题。

使用方法

  • /fixing-motion-performance 将以下约束应用于本次对话中的所有UI动画工作。

  • /fixing-motion-performance <file> 根据所有规则审查文件,并报告:

    • 违规(引用确切的行或片段)
    • 为什么重要(一句话)
    • 具体修复方法(代码级建议)

除非明确要求,否则不要迁移动画库。在现有技术栈内应用规则。

何时使用

在以下情况下参考这些指南:

  • 添加或更改UI动画(CSS、WAAPI、Motion、rAF、GSAP)
  • 重构卡顿的交互或过渡
  • 实现滚动关联运动或滚动时显示
  • 为布局、滤镜、蒙版、渐变或CSS变量添加动画
  • 审核使用will-change、transform或测量的组件

渲染步骤术语

  • 合成: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时间线进行滚动关联运动
  • 使用IntersectionObserver检测可见性和暂停动画
  • 不要轮询滚动位置来驱动动画
  • 当元素离开屏幕时暂停或停止动画
  • 滚动关联运动不得在大表面上触发持续的布局或绘制

5. 绘制(中高)

  • 仅在小且孤立的元素上允许触发绘制的动画
  • 不要在大容器上动画绘制密集型属性
  • 不要为transform、opacity或position动画CSS变量
  • 不要动画继承的CSS变量
  • 局部限定动画CSS变量的作用域,避免继承

6. 层(中)

  • 合成器动画需要层提升,不要假设已自动提升
  • 临时且精准地使用will-change
  • 避免创建过多或过大的提升层
  • 当性能重要时,使用工具验证层行为

7. 模糊与滤镜(中)

  • 保持模糊动画范围小(<=8px)
  • 仅将模糊用于短时一次性效果
  • 永远不要持续动画模糊
  • 永远不要在大表面上动画模糊
  • 在模糊之前优先使用opacity和translate

8. 视图过渡(低)

  • 仅将视图过渡用于导航级别的变化
  • 避免在交互密集的UI中使用视图过渡
  • 当需要中断或取消时避免使用视图过渡
  • 将尺寸变化视为可能触发布局的更改

9. 工具边界(严重)

  • 除非明确要求,否则不要迁移或重写动画库
  • 在现有动画系统内应用这些规则
  • 永远不要部分迁移API或在同一组件内混用样式

常见修复

/* 布局抖动:将宽度动画改为transform动画 */
/* 之前 */ .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.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches 007: Security audit, hardening, threat modeling (STRIDE/PASTA), Red/Blue Team, OWASP checks, code review, incident response, and infrastructure security for any project.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Agentfolio: Skill for discovering and researching autonomous AI agents, tools, and ecosystems using the AgentFolio directory.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Animejs Animation: Advanced JavaScript animation library skill for creating complex, high-performance web animations.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Astropy: Astropy is the core Python package for astronomy, providing essential functionality for astronomical research and data analysis.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Astro: Build content-focused websites with Astro — zero JS by default, islands architecture, multi-framework components, and Markdown/MDX support.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Emotional ARC Designer: One sentence - what this skill does and when to invoke it

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches I18n Localization: Internationalization and localization patterns.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Interactive Portfolio: Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches JQ: Expert jq usage for JSON querying, filtering, transformation, and pipeline integration.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Landing Page Generator: Generates high-converting Next.js/React landing pages with Tailwind CSS.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches LEX: Centralized ''Truth Engine'' for cross-jurisdictional legal context (US, EU, CA) and contract scaffolding.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Magic Animator: AI-powered animation tool for creating motion in logos, UI, icons, and social media assets.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Makepad Animation: CRITICAL: Use for Makepad animation system.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Nextjs APP Router Patterns: Comprehensive patterns for Next.js 14+ App Router architecture, Server Components, and modern full-stack React development.

Anhvu1107/all-agent-skill

ALWAYS use this when the user mentions Nextjs Best Practices, asks to build, debug, review, document, automate, test, configure, migrate, or make decisions in this domain, or the task clearly depends on Nextjs Best Practices; scope: Next.js App Router principles. Apply the bundled workflow, references, scripts, Senior Master standard, and Codex strict review gate before final output.

Anhvu1107/all-agent-skill

description: ALWAYS use this when the work is specifically about modern Next.js or React architecture, data flow, rendering strategy, routing, or performance-sensitive frontend behavior.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Nextjs Supabase Auth: Expert integration of Supabase Auth with Next.js App Router

Anhvu1107/all-agent-skill

ALWAYS use this when the task involves reading, extracting, splitting, merging, rotating, creating, validating, OCR-ing, form-filling, or otherwise producing or modifying PDF files.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches React Nextjs Development: React and Next.js 14+ application development with App Router, Server Components, TypeScript, Tailwind CSS, and modern frontend patterns.

Anhvu1107/all-agent-skill

ALWAYS use this when working with Remotion code, video compositions, rendering logic, timing, media assets, or React-based motion workflows.

相关技能