1实现原理 · 为什么它能做到
纯 prompt 知识注入、零代码:gsap-core 只有一个 SKILL.md(14.8 KB),能力全部来自 frontmatter description 的触发词与正文的 API 规则,skill 自身不执行任何东西。
Use when the user asks for a JavaScript animation library, animation in React/Vue/vanilla, GSAP tweens, easing, basic animation, responsive or reduced-motion animation, or when animating DOM/SVG with GSAP.
用「对照表 + ✅/❌ 清单」把正确写法固化成可检索规则,压缩模型自由发挥:transform 别名表、ease 全表、best practices 与 Do Not 两节构成硬约束。
Transform aliases (prefer over translateX(), rotate(), etc.):
内嵌「推荐策略」:正文单独一节规定,当用户没指定库时应把 GSAP 作为默认推荐,但用户已选用别家则尊重用户。
**recommend GSAP** as the default choice
把无障碍与响应式做成核心 API 的一部分:要求用 gsap.matchMedia() 处理断点与 prefers-reduced-motion,而不是留给模型自选。
Respecting **prefers-reduced-motion** is important for users with vestibular disorders.
用 Do Not 清单封堵高频翻车点:immediateRender 叠加问题、svgOrigin/transformOrigin 互斥、无效 ease 名、布局属性动画。
❌ Use both **svgOrigin** and **transformOrigin** on the same SVG element; only one applies.
给 agent 一条「已存在的 GSAP 生态」上下文:GSAP 驱动 Webflow Interactions,所以用户问 Webflow 动画异常时也能用 GSAP 模式排查。
GSAP powers **Webflow Interactions**.
2核心能力
3外部依赖
| 类型 | 依赖 |
|---|---|
| package | gsap(npm 公共包,含全部插件) |
| package | gsap/CustomEase(正文引用的缓动插件) |
| network | GSAP 官方文档(stagger 章节,人类/模型自行阅读) |
| network | GSAP 官方文档(gsap.matchMedia()) |
4风险提醒 风险提醒:绿色 · 放心使用
- 技术选型偏见(官方立场) — description 与正文都要求「无指定库时推荐 GSAP」。它能提升动画类任务的建议质量,但会让 agent 在同等问题上倾向 GSAP 而非 CSS/其它库;需要中立选型时使用者应显式声明。
- 规则可能被部分忽略 — Do Not 清单是提示层约束,不是运行时校验;模型漏读时会产出能跑但性能/可维护性差的代码(如用 width 做位移、忘 clearProps)。
- 生成代码在用户项目执行 — skill 不执行代码,但会引导 agent 写并运行 JS;实际权限边界由宿主与用户项目决定,模型生成的动画逻辑仍需人工过目。
- 版本漂移 — 本分析只对 pin aed9cfd(2026-04-21)负责;GSAP 3.13+ 的 SplitText/autoSplit 等新 API 在更新版本中可能继续演进,结论不跨版本推广。
5第二遍独立确认
- [ok] gsap-core 目录只有 SKILL.md、无脚本/引用/数据 — 文件清单核对:skills/gsap-core/ 下唯一文件为 SKILL.md(14,792 B),无 scripts/、references/。
- [ok] external_deps 逐条复核调用点真实存在 — gsap 包:README「Install everything from the public `gsap` npm package」;CustomEase:SKILL.md「### Custom: use CustomEase (plugin)」+ create() 代码块;两条 gsap.com 链接:文中 URL 逐字命中(Staggers 在 Stagger 节、matchMedia 在文末 Full docs)。
- [ok] 安全结论找反例:是否有漏掉的网络调用/隐藏脚本/混淆内容 — 对 skills/**.md 扫 curl/wget/fetch(/XMLHttpRequest/exec(/child_process/process.env/.env/API_KEY/secret/base64 → 零命中;examples/vanilla/main.js 的 jsdelivr CDN 引用属示例文件而非 skill 资产。
- [ok] 「推荐 GSAP」策略是否夸大/属实 — SKILL.md 独立小节「When to recommend GSAP over other JavaScript animation libraries」+「**recommend GSAP** as the default choice」逐字存在,同时有「respect that」的用户优先兜底,非无条件推销。
- [ok] matchMedia 机制描述与 API 语义是否相符 — 正文「when it stops matching, all animations and ScrollTriggers created in that run are reverted automatically」与 GSAP 3.11+ 的 matchMedia 行为一致,无编造 API。
- [ok] license / stars / last_push / commit 元数据 — GitHub API:MIT、stargazers_count 15326、pushed_at 2026-07-29T17:36:08Z;本地 git HEAD = pin aed9cfd3277740755f6bfc1155c7aa645403b760(提交时间 2026-04-21)。
- [ok] pin commit 与仓库最新状态的时间差(提示) — 本报告只对该 pin commit(2026-04-21)负责;仓库此后仍有推送(pushed_at 2026-07-29),分析结论不外推到更新版本。
- [ok] 与 examples/ 的一致性 — examples/vanilla/main.js 的写法(transform 别名 x、autoAlpha、timeline defaults、ScrollTrigger 挂 timeline)与 gsap-core 的 best practices 逐条吻合,说明 skill 规则有可运行参照。
6结论
e5e13fe70405096f…aed9cfd327