Communitygithub.com

动画性能修复与诊断

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

动画性能修复与诊断 是什么?

本技能专注于诊断和修复UI动画与过渡中的性能问题。它提供了一套系统化的规则,涵盖“禁止模式”、“选择机制”、“测量”、“滚动”、“绘制”、“层”、“模糊与滤镜”、“视图过渡”和“工具边界”等类别,并按关键、高、中、低优先级排列。该技能可用于审查文件中的违规行为,解释问题原因并提供具体代码级修复方案。它支持CSS、WAAPI、Motion、rAF和GSAP等动画系统,但除非明确要求,否则不迁移动画库。通过遵循这些规则,开发者可以避免布局抖动、滚动性能瓶颈和不必要的绘制开销,实现流畅的60fps动画。该技能适用于Claude Code平台,通过`/fixing-motion-performance`命令触发,可选择指定文件进行审查。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/AlperTuncOrtak/crypto-data-pipeline/tree/HEAD/skills/fixing-motion-performance

在你喜欢的 AI 中提问

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

文档

修复运动性能

修复动画性能问题。

使用方法

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

  • /fixing-motion-performance <file> 对照以下所有规则审查文件并报告:

    • 违规项(引用确切代码行或片段)
    • 为什么重要(一句简短说明)
    • 具体修复方案(代码级建议)

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

何时使用

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

  • 添加或更改UI动画(CSS、WAAPI、Motion、rAF、GSAP)
  • 重构卡顿的交互或过渡
  • 实现滚动关联动画或滚动时显示效果
  • 动画化布局、滤镜、遮罩、渐变或CSS变量
  • 审查使用will-change、变换或测量的组件

渲染步骤术语表

  • 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或滚动事件驱动动画
  • 不要使用没有停止条件的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.

AlperTuncOrtak/crypto-data-pipeline

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

AlperTuncOrtak/crypto-data-pipeline

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

AlperTuncOrtak/crypto-data-pipeline

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

AlperTuncOrtak/crypto-data-pipeline

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

AlperTuncOrtak/crypto-data-pipeline

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

AlperTuncOrtak/crypto-data-pipeline

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.

AlperTuncOrtak/crypto-data-pipeline

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.

AlperTuncOrtak/crypto-data-pipeline

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

AlperTuncOrtak/crypto-data-pipeline

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

AlperTuncOrtak/crypto-data-pipeline

Best practices for Remotion - Video creation in React

AlperTuncOrtak/crypto-data-pipeline

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

AlperTuncOrtak/crypto-data-pipeline

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

AlperTuncOrtak/crypto-data-pipeline

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.

AlperTuncOrtak/crypto-data-pipeline

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

AlperTuncOrtak/crypto-data-pipeline

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.

AlperTuncOrtak/crypto-data-pipeline

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.

AlperTuncOrtak/crypto-data-pipeline

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

AlperTuncOrtak/crypto-data-pipeline

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

AlperTuncOrtak/crypto-data-pipeline

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.

AlperTuncOrtak/crypto-data-pipeline

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

相关技能