motion-figure
它能做什么
这项技能制作会运动或对输入作出反应的图表和图示。适合希望读者看到过程随时间变化、或调整某个数值并观察结果的作者和教育工作者。
适用场景
- ✓当课程讲解一个随时间变化的流程,例如一个逐渐被填满的队列时。
- ✓当公式需要一个滑块,让读者看到某个输入如何改变结果时。
- ✓当页面需要一个交互式演示,让读者改变一项内容并看到系统的反应时。
技能链接
https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/.claude/skills/motion-figure/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请制作一个滑块图示,展示学习率如何改变训练曲线。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体从三种形式中选择一种:课程中的简单动画或滑块、真实系统的交互面板,或移动的背景条带。然后,它使用部件的真实名称构建图示。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Motion figure
This skill makes figures that move or respond to input. It has three tiers. Use this skill with Claude, Cursor, Codex, OpenClaw, Hermes, or any agent that reads SKILL.md.
| Tier | What it makes | Where it goes |
|---|---|---|
| 1. Lesson figure | Declarative SMIL animation, or a slider widget that redraws an SVG. Both mount from a ```figure fence. | Course lessons |
| 2. Mechanism figure | An HTML panel that shows the named parts of a system. The reader drives one control and reads a computed verdict. | Standalone pages, READMEs, essays, the course site outside lessons |
| 3. Dither field | A WebGL band of ordered dither dots in the paper, accent, and ink colours, with four seeded motions. | Page mastheads and section breaks |
Tier 1 has the most rules, because the lesson runtime has hard limits. Tiers 2 and 3 have their own reference files.
When to use
- A lesson explains a process that changes over time: a token that moves through stages, a queue that fills, a loop that repeats.
- A lesson explains a formula where one input changes the output: learning rate, temperature, chunk size, batch size.
- An author writes "animate this figure", "add a slider", or "make the diagram interactive".
- A page needs a demo where the reader changes one thing and sees what the system does: a cache, a queue, a context window, a router. Use tier 2.
- A page needs a slow moving header in the course colours. Use tier 3.
When not to use
- The idea is a fixed structure with no time axis and no input. Make a static SVG figure. The sibling skill
blueprint-figurecovers static figures. - The page is a full explainer page with its own state model and machine geometry. The sibling skill
isometric-explainercovers that. - You only need palette, fonts, or prose rules. The sibling skill
course-styleholds those. This skill copies the parts it needs intoreferences/tokens.md.
Method
Write one sentence that names the single change the figure shows. If you need two sentences, make two figures.
Pick the tier. Inside a lesson, use tier 1. For tier 2, read
references/mechanism-figures.mdand start fromtemplates/mechanism.html. For tier 3, readreferences/dither-fields.mdand copytemplates/dither.js. The steps below are for tier 1. In tier 1, use an animated figure when time is the variable. Use a slider widget when a number is the variable.Pick a name in kebab case, for example
request-pathorcontext-budget. Search the registry for that name first. A later module that registers the same name replaces the earlier figure.Put the code in a module file named
figures-<topic>.js. Wrap it in an IIFE, readwindow.LF, and return early if it is missing.Write a figure function
function (host, cfg). It appends one.lfcard tohostand can return a dispose function.Build the card:
.lf-headwith an uppercase.lf-labeland a short hint,.lf-body, and.lf-capwith the caption.Use
viewBox="0 0 520 H"for the SVG. Most course figures use an H from 200 to 250. A single bar needs less.Add a
<title>and a<desc>with ids that you create once, outside any render function.For an animated figure, add entries first, then one slow loop. Follow
references/smil-rules.mdline by line.For a slider widget, define
state._renderbefore you callLF.sliderorLF.select. Then callstate._render()once at the end.Call
LF.register({ 'your-name': fn })at the end of the module.In the lesson Markdown, add the fence. Put the name on the first line and optional JSON config after it:
```figure context-budget {"windowK": 32} ```Run the checks in "Check before you finish". Look at the figure in light theme, dark theme, at 375 px width, and with reduced motion on.
How the page mounts a figure
- The Markdown parser turns the fence into
<div class="lesson-figure" data-figure="name {json}">. - The site build scans lesson Markdown for fence names. It finds the module file that contains the quoted name and writes a manifest. A fence name with no provider stops the build.
- The page loads only the modules that the lesson needs, in a fixed order. New module files go after the listed ones, in alphabetical order.
- The mount function reads the first word as the name and parses the rest as JSON. Bad JSON gives an empty
cfg. - If the figure function throws, the runtime empties the host and logs a warning. The rest o
常见问题
它能制作哪些类型的图示?
它可以制作课程动画、滑块组件、交互式机制面板以及移动的抖动条带。
它需要特殊软件吗?
它生成在浏览器中运行的网页图示。
它适用于静态图表吗?
不适用。静态图表由另一项名为 blueprint-figure 的技能处理。
详情
作者的原始描述
Builds figures that move or respond to the reader, in three tiers: SMIL animations and slider widgets inside lessons, interactive mechanism figures that show the named parts of a real system with a computed verdict, and ordered dither bands in the course palette. Triggers: "animated figure", "add a slider widget", "interactive figure", "show how this system works", "make this diagram move", "dither masthead", "mechanism figure", "figure fence".
热度
- GitHub 星标
- 76k
- 排名
- #2625
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
blueprint-figure
76k帮你的智能体为课程、README 和手册绘制清晰的静态 SVG 图示,展示系统中真实部件之间的连接关系。
build-project
76k充当项目导师,每次带你完成一个实践 AI 项目阶段,提供提示和评分,但不给出完整答案。
check-understanding
76k对 AI Engineering from Scratch 课程中已完成的阶段进行小测验,让你在进入下一阶段前检查自己学到了什么。
claude-certification
76k在 AI Engineering from Scratch 课程的 Claude 认证路线中充当分步导师,提供课程、实验和练习考试。