manim
This skill should be used when the user asks to "make a math animation", "animate an equation", "use Manim", "make a 3Blue1Brown-style video", "plot or animate a graph/function", "visualize a math/physics/CS concept", "morph one formula into another", "animate a geometric proof", or "render a math explainer". Covers Manim Community Edition — Scenes, Mobjects, animations, LaTeX/MathTex, graphs, updaters/ValueTracker, 3D, and rendering to MP4/GIF via the CLI.
1How It Works & Mechanism
It turns mathematical animation into declarative Python: sequential play/wait calls inside construct() of a Scene subclass, where Manim evaluates each Mobject's state and Animation onto a timeline, rendering deterministic MP4/GIF frame-by-frame via the CLI.
Every scene is declarative: you build vector objects, play timed animations over them, and render a deterministic MP4/GIF from the CLI.
All capabilities stem from a triad: Scenes (orchestration) act on Mobjects (vector objects), expressed through Animations (timed transitions); all animation code lives in the single construct() method.
Everything is **Scenes** (orchestration) acting on **Mobjects** (objects) via **Animations** (timed change).
Mathematical typesetting is handled by LaTeX (Tex/MathTex, which must use raw string r"..."), while plain text is handled by Pango (Text/MarkupText, no LaTeX required) — this division directly dictates runtime prerequisites (whether a TeX distribution must be installed).
**LaTeX is required** for `Tex`/`MathTex` (not for `Text`).
Function and geometry animations are expressed using Axes + ax.plot, with ax.c2p mapping mathematical coordinates to screen space (hardcoding screen coordinates is prohibited); dynamic values rely on ValueTracker paired with always_redraw/add_updater to recalculate dependent objects per frame (e.g., points along curves, counters, tangents).
Drive live values with `ValueTracker` + `always_redraw`/`add_updater` so dependent mobjects recompute every frame
3D and cameras form a distinct layer: ThreeDScene + set_camera_orientation / Surface / begin_ambient_camera_rotation; 2D uses MovingCameraScene with self.camera.frame.animate for zoom-in, tracking, and reset.
`ThreeDScene` + `set_camera_orientation(phi=, theta=)`, `ThreeDAxes`, `Surface`, `begin_ambient_camera_rotation()`
Determinism is a key selling point: the same scene renders identical frames, allowing a verification strategy where frames are rendered first (PNG, no video encoding) to verify math and layout before committing to full video output.
Manim is deterministic — the same scene renders the same frames — so verify by rendering **frames** (PNG, no video encode) before committing to the full video.
The CLI provides three quality control levers: -s saves the last frame as PNG (no encoding), -n a,b renders only an animation index range (stopping mid-scene to check a single frame), and -q l iterates at low quality; once verified, -qh outputs the final video under media/videos|images.
- `-s` — **save the last frame as a PNG** (no video encode — the verification lever, see below).
Capability boundaries are explicitly drawn: no UI animations, social media/marketing videos, or CSV business charts; its core strength lies in mathematical typesetting and intuitive visualization.
Not the tool for UI motion, social/marketing video, or data-from-CSV business charts
Wall-clock timing and unseeded randomness are prohibited: construct() executes only once to script the timeline without a real-time loop; random operations must be seeded.
`construct()` runs once to *script* the timeline; there is no realtime loop — never use wall-clock time or randomness without a seed.
2Core Capabilities
3External Dependencies
| Kind | Dependency / Endpoint |
|---|---|
| cli | pip install manim(安装 Manim Community Edition,含 Python 3.9+ / ffmpeg / LaTeX 三项前置说明) |
| cli | manim CLI(-q / -p / -s / -n / --format=gif 渲染与质检) |
| package | Manim Community Edition(数学动画引擎本体,官方发包) |
| package | LaTeX 发行版(TeX Live / MiKTeX):仅 Tex / MathTex 需要;Text / MarkupText 走 Pango 不需要 |
| package | numpy(Manim 的数学依赖;reference 的 3D 曲面前置直接用 np.sin/np.cos) |
| cli | ffmpeg / ffprobe(Manim 编码 MP4 的底层依赖;仓库根 contact-sheet.sh 拼图与 probe-mp4.sh 断言) |
| network | 运行时无网络调用:skill 不访问任何 API/CDN;Manim 场景是纯本地 Python + 本地 ffmpeg + 本地 LaTeX 编译 |
4Recommended Governance & Evidence
- scripts/: Executes local script or command: manim CLI (-pql / -sql / -s / -n a,b / -qh / -qm --format=gif) for local rendering and QA, evaluating scenes frame-by-frame
- 网络端点: Declares external network access: Zero runtime network calls: Manim scenes run as purely local Python + local ffmpeg + local LaTeX; the skill references no external APIs, CDNs, or remote servers
- 本地工作目录: File read/write and artifact output: media/videos/<file>/<quality>/<Scene>.mp4 and media/images/.../<Scene>.png (-s)
5Second-Pass Verification
- [ok] 外部依赖调用点复核(pip install manim / manim CLI / ffmpeg / LaTeX / numpy) — SKILL.md Setup 节确有 `pip install manim # needs Python 3.9+, ffmpeg, and a LaTeX distribution (for Tex/MathTex)` 与 `manim -pql scene.py SquareToCircle`;verify 段确有 `manim -sql scene.py MyScene -n 0,3`;math-and-text 确有 TeX Live/MiKTeX 说明;3d-and-camera 确有 np.sin/np.cos 用法;仓库根 scripts/README.md 确有 manim 与 probe-mp4 的用法示例。全部落地,非推测。
- [ok] 「运行期零网络」反查 — 四份文档与仓库脚本中无 API endpoint、无 curl/wget、无 fetch/requests、无 CDN import;Manim 场景全部是本地 Python 对象构造。唯一网络相关表述集中在 Setup 的包安装指令。结论成立。
- [ok] 无凭证 / 无 env 读取 — 全文无 API_KEY/token/secret/.env/.netrc 读取,无浏览器 cookie 取用,无环境变量透传;与同 pack 的 Remotion 系(走 npm 远端包)和 generative-illustration(走 OPENROUTER_API_KEY)形成鲜明对比。
- [ok] 确定性主张的成立条件 — SKILL.md 明确「Manim is deterministic — the same scene renders the same frames」,并在 gotchas 收尾补上边界:「never use wall-clock time or randomness without a seed」——即确定性依赖于不引入墙钟、随机须播种。主张有边界,非无条件承诺。
- [ok] 目录资产面清点 — skills/manim/ 下仅 SKILL.md(136 行)、references/ 三份(math-and-text 70 行 / graphs-and-updaters 61 行 / 3d-and-camera 68 行)、0 字节 README.md;无 scripts/、无 .py 样例文件、无模板资产——「纯指令 + reference」结论成立(场景脚本由使用者/agent 现写)。
- [discrepancy] 跨引用可解析性 — SKILL.md 提到「the `motion-design-skills` pack (`animation-principles` ...)」——该 pack 与 animation-principles 均不在本 repo(本 repo 仅 skills/manim 一个 skill),属同作者的另一个 pack,单装本 repo 时该引用悬空。另正文引用的 `scripts/contact-sheet.sh`、`scripts/probe-mp4.sh` 位于本 repo 根,单装 skill 目录会悬空。
- [ok] 能力边界声明与正文覆盖的一致性 — SKILL.md 自述「Not the tool for UI motion, social/marketing video, or data-from-CSV business charts」,而正文与三份 reference 确实只覆盖数学排版、函数/图形、3D 与相机;未出现与自述边界冲突的内容(无 UI/营销/CSV 章节)。
- [ok] 档位判据与站内先例的一致性 — 判蓝的两条支撑:① 依赖以「安装指令」形式出现、执行的是本地 CLI(先例 gsap-react 明确不因 npm 依赖抬档;hyperframes-animation/hyperframes-audio 因官方包安装 + 本地 CLI + 本地读写判蓝);② 运行期无网络外发、无凭证、无采集(不满足黄/橙)。同时保留「有外部依赖 + 有本地写盘 + TeX 编译面」的现实,故不判绿。判据留痕如上,便于复核与跨批次口径统一。
6Verdict & Scenarios
5ebe4ae4e425d911…