gsap-performance
Official GSAP skill for performance — prefer transforms, avoid layout thrashing, will-change, batching. Use when optimizing GSAP animations, reducing jank, or when the user asks about animation performance, FPS, or smooth 60fps.
1How It Works & Mechanism
Core model in one sentence: animate only compositor-friendly transform and opacity properties, avoiding layout and repaint triggers.
keeps work on the compositor and avoids layout and most paint.
Strict usage boundaries for will-change: apply it only to elements that truly animate, never blindly.
It hints the browser to promote the layer.
Separation of reads and writes prevents layout thrashing: when mixing GSAP with manual DOM reads/writes, complete all reads first before performing batch writes.
Prefer doing all reads first, then all writes
gsap.quickTo() is the right tool for high-frequency updates: reuse a single tween instead of instantiating a new one on every event.
It reuses a single tween instead of creating new tweens on each update.
Provides 'lower-cost equivalent' replacement rules for multi-element setups: use stagger instead of multiple manual delays, and use virtualization or animate only visible items for long lists.
- Use **stagger** instead of many separate tweens with manual delays when the animation is the same;
Dedicated performance section for ScrollTrigger: minimize pinning, use numeric scrub values, and debounce refresh calls only when layout genuinely changes.
Call **ScrollTrigger.refresh()** only when layout actually changes (e.g. after content load), not on every resize; debounce when possible.
Treat cleanup as a performance item: pause or kill off-screen/inactive animations to avoid constantly consuming main thread resources and memory.
❌ Ignore cleanup; stray tweens and ScrollTriggers keep running and can hurt performance and correctness.
2Core Capabilities
3External Dependencies
| Kind | Dependency / Endpoint |
|---|---|
| package | gsap(quickTo 属核心 API) |
4Recommended Governance & Evidence
- SKILL.md: Pure prompt directives and rule text with no script execution or external impact
5Second-Pass Verification
- [ok] 目录资产面:仅 SKILL.md — skills/gsap-performance/ 下唯一文件 SKILL.md(4,139 B);无 scripts/、references/、数据文件;URL 扫描 0 条。
- [ok] external_deps 只剩 gsap 包 — 文件内无任何 URL 或第三方工具引用,仅使用 gsap.quickTo 与 ScrollTrigger.refresh 等本体 API;包依赖证据取自 README 安装段。
- [ok] quickTo 的描述是否与官方一致 — gsap.quickTo(target, property, vars) 返回可反复调用的函数、内部复用单个 tween,与官方 API 语义一致;示例(mousemove 中调用 xTo/yTo)即官方推荐写法。
- [ok] 「scrub 数值可减少滚动期工作量」是否为夸大 — 原文措辞为「**scrub** with a small value (e.g. `scrub: 1`) can reduce work during scroll; test on low-end devices.」——带不确定性限定与实测建议,非断言,不构成夸大。
- [ok] 安全反例搜索 — token 扫描:curl/wget/fetch(/XMLHttpRequest/exec(/child_process/process.env/.env/API_KEY/secret 零命中;无外部资源引用。
- [ok] 与 gsap-scrolltrigger 的 refresh 叙述是否冲突 — scrolltrigger 要求布局变化后必须 refresh()(否则位置失准),performance 要求不要每次 resize 都 refresh 并去抖——两者互补而非矛盾(resize 本就被 ST 自动去抖处理)。
- [ok] 元数据与 pin — frontmatter license: MIT;HEAD = aed9cfd3277740755f6bfc1155c7aa645403b760;GitHub API stars 15326 / pushed_at 2026-07-29T17:36:08Z。
- [ok] 是否只是「常识复述」(价值质疑) — 文中给出具体替换对象(width/height/top/left → x/y/scale)、具体 API(quickTo)、具体数值建议(scrub: 1)与具体反例(just in case 加 will-change),超出泛泛常识。
6Verdict & Scenarios
a5bb2ad20a79ec59…