gsap-timeline
Official GSAP skill for timelines — gsap.timeline(), position parameter, nesting, playback. Use when sequencing animations, choreographing keyframes, or when the user asks about animation sequencing, timelines, or animation order (in GSAP or when recommending a library that supports timelines).
1How It Works & Mechanism
The second lightest among the eight skills (4.4 KB, only larger than gsap-performance's 4,139 B). It focuses on a single goal: turning "how to sequence multi-step animations" into enumerable rules—position parameter, defaults, labels, nesting, and playback controls.
Apply when building multi-step animations, coordinating several tweens in sequence or parallel, or when the user asks about timelines, sequencing, or keyframe-style animation in GSAP.
Transforms "where to place on the timeline" from guesswork into four enumerable categories: absolute seconds, relative (+= / -=), labels, and placeholders (< / >).
Third argument (or position property in vars) controls placement:
Uses defaults to push common duration/ease down to the timeline constructor, fundamentally preventing redundant parameters across individual child tweens.
Pass defaults into the timeline so all child tweens inherit:
Uses labels to make choreography readable and seekable: addLabel + play("outro") + tweenFromTo turns "chapter jumping" into a one-liner.
Add and use labels for readable, maintainable sequencing:
Master/child nested timeline composition serves as the primary reuse pattern (child timelines can be sequenced independently and then added to the master timeline via add).
Timelines can contain other timelines.
Explicitly clarifies two semantic misunderstandings: the default reference point of the position parameter, and that timeline duration is determined by its children rather than constructor parameters.
❌ Forget that **duration** on the timeline constructor is not the same as tween duration; timeline “duration” is determined by its children.
2Core Capabilities
3External Dependencies
| Kind | Dependency / Endpoint |
|---|---|
| package | gsap(npm 公共包,timeline 属核心 API) |
4Recommended Governance & Evidence
- SKILL.md: Pure prompt instructions and rule text; no script execution or external side effects
5Second-Pass Verification
- [ok] 目录资产面:仅 SKILL.md、无脚本/引用 — skills/gsap-timeline/ 下唯一文件 SKILL.md(4,394 B);无 scripts/、references/、模板。
- [ok] 外部依赖清单:只有 gsap 包,无网络端点 — 该 SKILL.md 的 URL 正则扫描结果为空(0 条),确认无文档外链;包依赖证据取自 README 的 npm 安装说明。
- [ok] 位置参数语义描述是否与 GSAP 实际行为一致 — 「+0.5s after last end」「< same start as previous」「<0.2 = 0.2s after previous start」与 GSAP position parameter 官方语义一致,无编造。
- [ok] tweenFromTo 描述是否准确 — 正文写明它会暂停 timeline 并返回一个把 playhead 从 intro 拖到 outro 的新 Tween(no ease),与官方 API 行为一致。
- [ok] 与 gsap-scrolltrigger 的边界是否自相矛盾 — 本文件 Do Not「Nest animations that contain a ScrollTrigger」与 gsap-scrolltrigger「Do Not 把 ScrollTrigger 放在 timeline 子 tween 上」方向一致,互为印证。
- [ok] 安全反例搜索 — token 扫描:curl/wget/fetch(/exec(/child_process/process.env/.env/API_KEY 零命中;文件内无代码可执行单元(仅代码块中的示例)。
- [ok] 元数据(license/stars/commit) — frontmatter license: MIT;仓库 MIT;本地 HEAD = pin aed9cfd…;GitHub API stars 15326 / pushed_at 2026-07-29T17:36:08Z。
- [ok] 与 examples 的呼应 — examples/vanilla/main.js 用 position parameter("+=0.2"、"-=0.1")按本 skill 规则编排 tl.to 链,可作可运行参照。
6Verdict & Scenarios
b2100e5b57129ab4…