animation-performance
它能做什么
这项技能检查 CSS 动画中会拖慢渲染的属性。适合希望网站动效流畅的开发者。
适用场景
- ✓当网页上的 CSS 动画看起来卡顿或不流畅时。
- ✓当样式表中的动画改变了尺寸、位置或外边距时。
- ✓当你希望动画尊重减少动态效果的设置时。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/animation-performance/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我的菜单滑入动画在手机上有卡顿。请帮我检查 CSS,并让它更流畅。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会找出改变布局属性的动画,把它们改为 transform 和 opacity 的变化,并建议尊重减少动态效果的设置。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Use transform and opacity for animations
Animating layout properties (width, height, top, margin) triggers the full browser rendering pipeline on every frame — style recalculation, layout, paint, and composite. This runs on the main thread and competes with JavaScript. Animating transform and opacity skips layout and paint entirely and runs on a dedicated GPU thread, achieving smooth 60fps even when the main thread is busy.
Quick Reference
- Only transform and opacity can be composited on the GPU without triggering layout
- Use will-change: transform sparingly to promote an element to its own compositor layer
- Prefer CSS transitions and animations over JavaScript animation libraries for simple effects
- Respect prefers-reduced-motion to disable animations for users who need it
Check
Find CSS animations or transitions in this file that animate layout-triggering properties like top, left, width, height, or margin. Flag them for optimization.
Fix
Convert layout-triggering animations to use transform equivalents: position changes to translate(), size changes to scale().
Explain
Explain the browser rendering pipeline, why transform and opacity are performant for animation, and how the GPU compositor works.
Code Review
Review stylesheets, component styles, and responsive states related to Use transform and opacity for animations. Flag exact selectors, declarations, or breakpoints that violate the rule in the rendered UI.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/css/animation-performance
常见问题
为什么 transform 和 opacity 更流畅?
这项技能说明,它们可以由图形处理器处理,不会在每一帧都触发布局和绘制。
will-change 有什么作用?
这项技能说明应谨慎使用它,为元素提供独立的渲染层。
简单的效果应该使用动画库吗?
这项技能建议,对于简单的效果,应优先使用 CSS 过渡和动画,而不是 JavaScript 动画库。
详情
作者的原始描述
Use when reviewing stylesheets, component styles, and responsive behavior related to Use transform and opacity for animations. Check the rendered layout across breakpoints and interaction states before proposing a fix.
热度
- GitHub 星标
- 75k
- 排名
- #2722
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。