diagram-animation
This skill should be used when the user asks to "animate this diagram", "build a flowchart that reveals step by step", "animate an architecture/sequence diagram", "make a chart animate in", "grow the bars / draw the line / count up the number", "show data flowing along a connector", or "turn a static diagram into a guided reveal". Covers SVG, Framer Motion, D3, and Remotion.
1How It Works & Mechanism
The core execution principle throughout is "progressive reveal": advance only one information beat at a time, strictly following the reveal order of nodes → edges → labels, paired with "focus + context" (active elements at full opacity, remaining elements dimmed to ~0.35) to prevent the viewer from getting lost.
Never show everything at once. Reveal in this order: **nodes → edges → labels**.
Line-drawing animations uniformly adopt the stroke-dashoffset mechanism, using pathLength="1" to normalize geometric length into a 0→1 progress value so the same dash parameter set drives edges of any length.
`pathLength="1"` lets one dash value drive any edge length.
Provides three minimal runnable implementations for chart animations: bars growing from the baseline via scaleY, polylines drawn on via getTotalLength + transition, and numbers interpolated/accumulated via rAF + easeOutCubic formatted with Intl.NumberFormat thousands separators.
| Count-up | interpolate value with eased `t` | `easeOutCubic` |
Deliveries are tracked by tiers: self-contained charts = single-file HTML (inline SVG + CDN libraries + a single inline script for the master timeline), and the page must support ?t=N freezing so headless screenshots capture deterministic frames.
if (t !== null) { tl.pause(); tl.seek(parseFloat(t)); }
Verification loop = take headless screenshots at start, mid, and end timestamps, with visual inspection covering two aspects: fidelity (reveal order, connector endpoints, whether count-up lands on exact values) and artifacts (truncated labels, off-screen nodes, font FOUC, seam stuttering).
count-ups land on the EXACT values
reduced-motion provides a final-state branch rather than a degraded animation: looping animations immediately use animation:none to display the fully composited final frame.
`prefers-reduced-motion` path shows the final composed diagram without looping motion.
2Core Capabilities
3External Dependencies
| Kind | Dependency / Endpoint |
|---|---|
| cli | npx / Playwright(无头截图) |
| cli | ffmpeg(contact-sheet.sh 拼图) |
| cli | npx -y playwright(仓库根 seek-shot.sh 内部) |
| network | jsDelivr CDN:gsap ESM(交付物在浏览器端加载) |
| package | 第三方动画/图表库:GSAP、Framer Motion、D3、anime、Remotion(自 CDN 或 npm 引入) |
4Recommended Governance & Evidence
- scripts/: Execute local scripts or commands: npx playwright screenshot --wait-for-timeout=500 … (SKILL.md Verify loop inline command)
- 网络端点: Declare external network access: the skill itself makes no business API calls; network footprint comes from toolchains—npx fetches playwright packages from registry.npmjs.org and downloads Chromium binaries
- 本地工作目录: File I/O and artifact output: frame-mid.png (SKILL.md inline screenshot example output), frame-<t>.png (seek-shot.sh output)
5Second-Pass Verification
- [ok] 外部依赖调用点复核(npx playwright / ffmpeg / CDN) — SKILL.md Verify loop 内确有 `npx playwright screenshot --wait-for-timeout=500 "file://$PWD/diagram.html?t=1.2" frame-mid.png`;仓库根 scripts/seek-shot.sh 同为 npx playwright 截图、scripts/contact-sheet.sh 为 ffmpeg hstack;SKILL.md 顶部代码块确有 cdn.jsdelivr.net 的 gsap ESM import。三条均落地,非推测。
- [ok] 无凭证 / 无 env / 无业务 API 反查 — skill 两个文档与三个仓库脚本中无 API_KEY/token/secret/.env 读取、无 curl/wget、无 fetch 到业务端点;唯一远程动作是包管理器与 CDN 静态资源。判 orange 的依据只是「远程包/镜像」,不含凭据读取。
- [ok] 目录资产面清点 — skills/diagram-animation/ 下仅 SKILL.md(163 行)、references/ 一份 218 行 cookbook、0 字节 README.md;无 scripts/、无模板、无数据文件——「纯指令 + 内联代码片段」结论成立。
- [discrepancy] 跨引用可解析性 — SKILL.md 有两处引用落在本 skill 目录外:`scripts/seek-shot.sh`/`scripts/contact-sheet.sh` 位于仓库根(单装本 skill 目录会悬空,需装整个 repo);`see remotion-video` 指向的 remotion-video 不在本 repo 的 5 个 skill 中(属同作者 motion-design-skills pack),同样悬空。同 repo 内的 whiteboard → explainer-video 引用可解析。
- [ok] 功能声明 vs 实际能力 — frontmatter 宣称覆盖 SVG / Framer Motion / D3 / Remotion 四栈,正文 Build-tool choice 逐栈给出适用判据,reference 给出对应可运行实现(Framer Motion pathLength、D3 数据绑定、Remotion spring/interpolate);无夸大,也未声称能自动出图或代跑渲染。
- [ok] 「确定性」主张的成立条件 — 成立范围有明确边界:GSAP/JS 主时间轴的 ?t 冻结与 Remotion 帧驱动路径可逐帧确定;而 CSS keyframes/transition 分支本身不可 seek,SKILL.md 明确要求「drive reveal order with `animationDelay`; freeze by pausing/seeking the equivalent JS timeline」并给出 prefers-reduced-motion 终态——主张非无条件承诺。
6Verdict & Scenarios
e196243bfb566372…