Communitygithub.com

delorenj/skills

使用 Manim CE 制作 3Blue1Brown 风格的数学/算法动画视频。

skills 是什么?

该技能为 AI 代理提供了一套完整的视频制作工作流,用于生成 3Blue1Brown 风格的教育动画。它基于 Manim Community Edition (v0.20+),支持概念解释、方程推导、算法可视化、数据故事、架构图、论文讲解和 3D 可视化等多种模式。工作流包含规划(plan.md)、编码(script.py)、渲染、拼接和可选的配音步骤。技能还提供了详细的创意指导,包括色彩搭配方案、动画速度、排版规范和每个场景的差异化设计原则。该技能可在 Python 环境中通过命令行运行,无需浏览器或 GPU,使用场景涵盖了从教学视频到科技演示的广泛需求。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/delorenj/skills/tree/HEAD/manim-video

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Manim 视频制作管线

使用时机

当用户请求:动画解释、数学动画、概念可视化、算法演示、技术讲解、3Blue1Brown 风格视频或任何包含几何/数学内容的程序化动画时使用。使用 Manim Community Edition 创建 3Blue1Brown 风格的解释视频、算法可视化、方程推导、架构图和数据故事。

创意标准

这是教育电影。每一帧都在教学。每一个动画都揭示结构。

在编写一行代码之前,先阐明叙事弧线。它纠正了什么误解?什么是“顿悟时刻”?什么视觉故事将观众从困惑引向理解?用户的提示是一个起点——要用教学抱负去诠释它。

几何先于代数。 先展示形状,再展示方程。视觉记忆比符号记忆编码更快。当观众在公式之前看到几何模式时,这个方程就显得理所当然。

首次渲染的品质不容妥协。 输出必须在视觉上清晰且美学上协调,无需修改轮次。如果某些内容看起来杂乱、时机不当或像“AI 生成的幻灯片”,那就是错的。

不透明度分层引导注意力。 永远不要将所有元素以全亮度显示。主要元素为 1.0,上下文元素为 0.4,结构元素(轴、网格)为 0.15。大脑分层处理视觉显著性。

留有呼吸空间。 每个动画后都需要 self.wait()。观众需要时间吸收刚刚出现的内容。切勿仓促地从一个动画跳到下一个。在关键揭示之后停顿 2 秒钟绝非浪费。

连贯的视觉语言。 所有场景共享色彩搭配、一致的字体大小、匹配的动画速度。一个技术上正确但每个场景都使用随机不同颜色的视频在美学上是失败的。

先决条件

运行 scripts/setup.sh 以验证所有依赖项。需要:Python 3.10+、Manim Community Edition v0.20+ (pip install manim)、LaTeX(Linux 上为 texlive-full,macOS 上为 mactex)和 ffmpeg。参考文档已在 Manim CE v0.20.1 上测试通过。

模式

模式输入输出参考
概念解释主题/概念带有几何直觉的动画解释references/scene-planning.md
方程推导数学表达式分步动画证明references/equations.md
算法可视化算法描述数据结构的分步执行references/graphs-and-data.md
数据故事数据/指标动画图表、比较、计数器references/graphs-and-data.md
架构图系统描述组件逐步构建并连接references/mobjects.md
论文讲解研究论文主要发现和方法动画化references/scene-planning.md
3D 可视化3D 概念旋转曲面、参数曲线、空间几何references/camera-and-3d.md

技术栈

每个项目单个 Python 脚本。无需浏览器、无需 Node.js、无需 GPU。

层级工具用途
核心Manim Community Edition场景渲染、动画引擎
数学LaTeX (texlive/MiKTeX)通过 MathTex 渲染方程
视频 I/Offmpeg场景拼接、格式转换、音频混合
语音合成ElevenLabs / Qwen3-TTS (可选)配音旁白

管线

规划 --> 编码 --> 渲染 --> 拼接 --> 音频 (可选) --> 审查
  1. 规划 (PLAN) — 编写 plan.md,包含叙事弧线、场景列表、视觉元素、色彩搭配、旁白脚本
  2. 编码 (CODE) — 编写 script.py,每个场景一个类,可独立渲染
  3. 渲染 (RENDER) — 使用 manim -ql script.py Scene1 Scene2 ... 生成草稿,-qh 生成成品
  4. 拼接 (STITCH) — 使用 ffmpeg 将场景剪辑拼接成 final.mp4
  5. 音频 (AUDIO) (可选) — 通过 ffmpeg 添加旁白和/或背景音乐。详见 references/rendering.md
  6. 审查 (REVIEW) — 渲染预览静态帧,对照计划验证,进行调整

项目结构

project-name/
  plan.md                # 叙事弧线、场景分解
  script.py              # 所有场景在一个文件中
  concat.txt             # ffmpeg 场景列表
  final.mp4              # 拼接后的输出
  media/                 # 由 Manim 自动生成
    videos/script/480p15/

创意指导

色彩搭配

搭配背景色主色辅色强调色用途
经典 3B1B#1C1C1C#58C4DD (蓝色)#83C167 (绿色)#FFFF00 (黄色)通用数学/计算机科学
暖色学术#2D2B55#FF6B6B#FFD93D#6BCB77平易近人
霓虹科技#0A0A0A#00F5FF#FF00FF#39FF14系统、架构
单色#1A1A2E#EAEAEA#888888#FFFFFF极简主义

动画速度

上下文run_time后面的 self.wait()
标题/介绍出现1.5秒1.0秒
关键方程揭示2.0秒2.0秒
变换/变形1.5秒1.5秒
支撑性标签0.8秒0.5秒
FadeOut 清理0.5秒0.3秒
“顿悟时刻”揭示2.5秒3.0秒

排版比例

角色字号用法
标题48场景标题、开场文字
标题36场景内的章节标题
正文30解释性文字
标签24注释、坐标轴标签
说明20字幕、细节信息

字体

所有文本使用等宽字体。 Manim 的 Pango 渲染器在任何大小下使用比例字体时都会产生错误的字距调整。完整建议请参见 references/visual-design.md。

MONO = "Menlo"  # 在文件顶部定义一次

Text("Fourier Series", font_size=48, font=MONO, weight=BOLD)  # 标题
Text("n=1: sin(x)", font_size=20, font=MONO)                  # 标签
MathTex(r"\nabla L")                                            # 数学 (使用 LaTeX)

最小 font_size=18 以保证可读性。

每个场景的变化

切勿为所有场景使用相同的配置。每个场景应:

  • 使用色彩搭配中的不同主色
  • 使用不同的布局 — 不要总是将所有内容居中
  • 使用不同的动画入场方式 — 交替使用 Write、FadeIn、GrowFromCenter、Create
  • 具有不同的视觉重量 — 有些场景密集,另一些稀疏

工作流程

步骤 1:规划 (plan.md)

在任何代码之前,编写 plan.md。完整模板请参见 references/scene-planning.md。

步骤 2:编码 (script.py)

每个场景一个类。每个场景可独立渲染。

from manim import *

BG = "#1C1C1C"
PRIMARY = "#58C4DD"
SECONDARY = "#83C167"
ACCENT = "#FFFF00"
MONO = "Menlo"

class Scene1_Introduction(Scene):
    def construct(self):
        self.camera.background_color = BG
        title = Text("Why Does This Work?", font_size=48, color=PRIMARY, weight=BOLD, font=MONO)
        self.add_subcaption("Why does this work?", duration=2)
        self.play(Write(title), run_time=1.5)
        self.wait(1.0)
        self.play(FadeOut(title), run_time=0.5)

关键模式:

  • 每个动画添加字幕:self.add_subcaption("text", duration=N) 或在 self.play() 中使用 subcaption="text"
  • 文件顶部共享颜色常量 确保场景间的一致性
  • 每个场景设置 self.camera.background_color
  • 干净退出 — 场景结束时许所有 mobject:self.play(FadeOut(Group(*self.mobjects)))

步骤 3:渲染

manim -ql script.py Scene1_Introduction Scene2_CoreConcept  # 草稿
manim -qh script.py Scene1_Introduction Scene2_CoreConcept  # 成品

步骤 4:拼接

cat > concat.txt << 'EOF'
file 'media/videos/script/480p15/Scene1_Introduction.mp4'
file 'media/videos/script/480p15/Scene2_CoreConcept.mp4'
EOF
ffmpeg -y -f concat -safe 0 -i concat.txt -c copy final.mp4

步骤 5:审查

manim -ql --format=png -s script.py Scene2_CoreConcept  # 预览静态帧

关键实现说明

LaTeX 使用原始字符串

# 错误: MathTex("\frac{1}{2}")
# 正确:
MathTex(r"\frac{1}{2}")

边缘文本的 buff >= 0.5

label.to_edge(DOWN, buff=0.5)  # 绝不能 < 0.5

替换文本前先 FadeOut

self.play(ReplacementTransform(note1, note2))  # 而不是在上面 Write(note2)

切勿动画尚未添加的 Mobject

self.play(Create(circle))  # 必须先添加
self.play(circle.animate.set_color(RED))  # 然后才动画

性能目标

质量分辨率帧率速度
-ql (草稿)854x480155-15秒/场景
-qm (中等)1280x7203015-60秒/场景
-qh (成品)1920x10806030-120秒/场景

始终在 -ql 质量下迭代。仅对最终输出渲染 -qh。

参考

文件内容
references/animations.md核心动画、缓动函数、组合、.animate 语法、定时模式
references/mobjects.md文本、形状、VGroup/Group、定位、样式、自定义 mobject
references/visual-design.md12 条设计原则、不透明度分层、布局模板、色彩搭配
references/equations.mdManim 中的 LaTeX、TransformMatchingTex、推导模式
references/graphs-and-data.md坐标轴、绘图、BarChart、动画数据、算法可视化
references/camera-and-3d.mdMovingCameraScene、ThreeDScene、3D 曲面、相机控制
references/scene-planning.md叙事弧线、布局模板、场景过渡、规划模板
references/rendering.mdCLI 参考、质量预设、ffmpeg、配音工作流、GIF 导出
references/troubleshooting.mdLaTeX 错误、动画错误、常见错误、调试
references/animation-design-thinking.md何时动画 vs 静态展示、分解、节奏、旁白同步
references/updaters-and-trackers.mdValueTracker、add_updater、always_redraw、基于时间的更新器、模式
references/paper-explainer.md将研究论文转换为动画——工作流、模板、领域模式
references/decorations.mdSurroundingRectangle、Brace、箭头、DashedLine、Angle、注释生命周期
references/production-quality.md编码前、渲染前、渲染后检查清单、空间布局、颜色、节奏

创意发散(仅在用户请求实验性/创造性/独特输出时使用)

如果用户要求创造性、实验性或非传统的解释方法,请在设计动画之前选择一种策略并阐述其理由。

  • SCAMPER — 当用户希望为标准解释带来新鲜视角时
  • 假设反转 — 当用户想要挑战某事物通常的教学方式时

SCAMPER 转换

以标准数学/技术可视化为基础进行转换:

  • 替代 (Substitute):替换标准的视觉比喻(数轴 → 蜿蜒路径,矩阵 → 城市网格)
  • 组合 (Combine):合并两种解释方法(代数 + 几何同时进行)
  • 逆向 (Reverse):反向推导——从结果开始,解构到公理
  • 修改 (Modify):夸大某个参数以显示其重要性(10 倍的学习率,1000 倍的样本量)
  • 消除 (Eliminate):移除所有符号——仅通过动画和空间关系进行解释

假设反转

  1. 列出关于该主题可视化的“标准”方式(从左到右、2D、离散步骤、正式符号)
  2. 选择最根本的假设
  3. 反转它(从右到左推导、2D 概念的 3D 嵌入、连续变形代替步骤、零符号)
  4. 探索反转所揭示的、标准方法所隐藏的内容

Individual skills in this repo

This repo contains 14 individual skills — each has its own dedicated page.

delorenj/skills

Plan and generate terminal ASCII animations/screensaver-style output (FPS, refresh rules, loop policy, low-flicker guidance), with a static poster frame and an optional local demo script.

delorenj/skills

ASCII video: convert video/audio to colored ASCII MP4/GIF.

delorenj/skills

Plan, build and quality-check a premium short commercial for a real business (roofing, property, ecommerce, B2B software) using AI-generated footage, code-built motion (HTML/GSAP), selective Three.js and an independent-critic "Gauntlet" loop. Use when asked to make a launch-style / SaaS-style video, business ad, explainer, sample reel or pitch video, or to review and improve one. Encodes motion principles distilled from 28 professional launch films, a quality bar, audio rules and a business-offer playbook.

delorenj/skills

CSS animation adapter patterns for HyperFrames. Use when authoring CSS keyframes, animation-delay based timing, animation-fill-mode, animation-play-state, or CSS-only motion that HyperFrames must seek deterministically during preview and rendering.

delorenj/skills

Generate professional voiceovers using ElevenLabs AI. Use when the user needs to create voiceovers for videos, audio narration, or text-to-speech content. Supports multiple voices with character presets (narrator, salesperson, expert) for natural delivery. Includes single scene regeneration for fine-tuning.

delorenj/skills

HyperFrames CLI dev loop — `npx hyperframes` for scaffolding (init), validation (lint, inspect), preview, render, and environment troubleshooting (doctor, browser, info, upgrade). Use when running any of these commands or troubleshooting the HyperFrames build/render environment. For asset preprocessing commands (`tts`, `transcribe`, `remove-background`), invoke the `hyperframes-media` skill instead.

delorenj/skills

Asset preprocessing for HyperFrames compositions — text-to-speech narration (Kokoro), audio/video transcription (Whisper), and background removal for transparent overlays (u2net). Use when generating voiceover from text, transcribing speech for captions, removing the background from a video or image to use as a transparent overlay, choosing a TTS voice or whisper model, or chaining these (TTS → transcribe → captions). Each command downloads its own model on first run.

delorenj/skills

Install and wire registry blocks and components into HyperFrames compositions. Use when running hyperframes add, installing a block or component, wiring an installed item into index.html, or working with hyperframes.json. Covers the add command, install locations, block sub-composition wiring, component snippet merging, and registry discovery.

delorenj/skills

Create video compositions, animations, title cards, overlays, captions, voiceovers, audio-reactive visuals, and scene transitions in HyperFrames HTML. Use when asked to build any HTML-based video content, add captions or subtitles synced to audio, generate text-to-speech narration, create audio-reactive animation (beat sync, glow, pulse driven by music), add animated text highlighting (marker sweeps, hand-drawn circles, burst lines, scribble, sketchout), or add transitions between scenes (crossfades, wipes, reveals, shader transitions). Covers composition authoring, timing, media, and the full video production workflow. For dev-loop CLI commands (init, lint, inspect, preview, render) see the hyperframes-cli skill; for asset preprocessing commands (tts, transcribe, remove-background) see the hyperframes-media skill.

delorenj/skills

Join a Google Meet or Zoom call as a video meeting agent via PikaStreaming. Trigger: user drops a Google Meet or Zoom link, or asks to join a meeting.

delorenj/skills

Translate an existing Remotion (React-based) video composition into a HyperFrames HTML composition. Use ONLY when the user explicitly asks to port, convert, migrate, translate, or rewrite a Remotion composition as HyperFrames (e.g. "port my Remotion project to HyperFrames"). Do NOT use when (a) authoring a NEW HyperFrames composition (even if A/B-testing a Remotion video); (b) Remotion is mentioned in passing; (c) Remotion code is shared as reference, not for translation; (d) the user wants "the same video as my Remotion one" without explicitly asking to migrate the source — treat as a fresh HyperFrames build. When in doubt, default to the `hyperframes` skill. Detects unsupported patterns (useState, useEffect side effects, async calculateMetadata, third-party React component libraries, `@remotion/lambda`) and recommends the runtime interop escape hatch instead of a lossy translation.

delorenj/skills

Generate speech using the self-hosted voxxy (vox) TTS service at https://vox.delo.sh. Use when the user asks to speak, say, narrate, synthesize speech, clone a voice, create a voice, add or register a voice, pipe TTS, or control voice qualities by description (e.g. "a young woman with a cheerful voice"). Handles HTTP API usage, voice profile management, description-based voice design, cloning, MCP registration, and integration patterns for new platforms.

delorenj/skills

Capture a website and create a HyperFrames video from it. Use when: (1) a user provides a URL and wants a video, (2) someone says "capture this site", "turn this into a video", "make a promo from my site", (3) the user wants a social ad, product tour, or any video based on an existing website, (4) the user shares a link and asks for any kind of video content. Even if the user just pastes a URL — this is the skill to use.

delorenj/skills

YouTube transcripts to summaries, threads, blogs.

相关技能