manimgl-best-practices by adithya-s-k/manim_skill
npx skills add https://github.com/adithya-s-k/manim_skill --skill manimgl-best-practices阅读各个规则文件以获取详细解释和代码示例:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
-se 标志的交互模式、checkpoint_paste()完整、经过测试的示例文件,展示了常见模式:
复制并修改这些模板以开始新项目:
from manimlib import *
class MyScene(InteractiveScene):
def construct(self):
# 创建 mobjects
circle = Circle()
# 添加到场景(静态)
self.add(circle)
# 或者进行动画
self.play(ShowCreation(circle)) # 注意:使用 ShowCreation,而不是 Create
# 等待
self.wait(1)
# 渲染并预览
manimgl scene.py MyScene
# 交互模式 - 在第 15 行进入 shell
manimgl scene.py MyScene -se 15
# 写入文件
manimgl scene.py MyScene -w
# 低质量用于测试
manimgl scene.py MyScene -l
| 功能 | ManimGL (3b1b) | Manim Community |
|---|---|---|
| 导入 | from manimlib import * | from manim import * |
| CLI | manimgl | manim |
| 数学文本 | Tex(R"\pi") | MathTex(r"\pi") |
| 场景 | InteractiveScene | Scene |
| 创建动画 | ShowCreation | Create |
| 相机 | self.frame | self.camera.frame |
| 固定在画面中 | mob.fix_in_frame() | self.add_fixed_in_frame_mobjects(mob) |
| 包 | manimgl (PyPI) | manim (PyPI) |
ManimGL 的杀手级功能是交互式开发:
# 从第 20 行开始,状态保留
manimgl scene.py MyScene -se 20
在交互模式下:
# 将代码复制到剪贴板,然后运行:
checkpoint_paste() # 运行动画
checkpoint_paste(skip=True) # 立即运行(无动画)
checkpoint_paste(record=True) # 运行时录制
# 获取相机帧
frame = self.frame
# 在 3D 中重新定向(phi、theta、gamma、中心点、高度)
frame.reorient(45, -30, 0, ORIGIN, 8)
# 动画相机移动
self.play(frame.animate.reorient(60, -45, 0))
# 固定 mobjects 在 3D 移动期间保持在屏幕空间
title.fix_in_frame()
# 使用大写 R 的原始字符串
formula = Tex(R"\int_0^1 x^2 \, dx = \frac{1}{3}")
# 使用 t2c 进行颜色映射
equation = Tex(
R"E = mc^2",
t2c={"E": BLUE, "m": GREEN, "c": YELLOW}
)
# 隔离子字符串用于动画
formula = Tex(R"\sum_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^2}{6}")
formula.set_color_by_tex("n", BLUE)
def construct(self):
circle = Circle()
self.play(ShowCreation(circle))
self.embed() # 在此处进入 IPython shell
self.set_floor_plane("xz") # 使 xy 成为观察平面
text = Text("Label")
text.set_backstroke(BLACK, 5) # 文本后面的黑色轮廓
# 安装 ManimGL
pip install manimgl
# 检查安装
manimgl --version
manimgl,而不是 manim(社区版)ShowCreation,而不是 CreateTexself.frame-se 标志进行交互式开发此技能包含改编自 Grant Sanderson 的 3Blue1Brown 视频仓库 的示例代码。
许可证: CC BY-NC-SA 4.0
完整详情请参阅 LICENSE.txt。
每周安装量
709
仓库
GitHub 星标数
669
首次出现
2026年1月22日
安全审计
安装于
claude-code564
gemini-cli483
opencode470
codex465
cursor405
antigravity326
Read individual rule files for detailed explanations and code examples:
-se flag, checkpoint_paste()Complete, tested example files demonstrating common patterns:
Copy and modify these templates to start new projects:
from manimlib import *
class MyScene(InteractiveScene):
def construct(self):
# Create mobjects
circle = Circle()
# Add to scene (static)
self.add(circle)
# Or animate
self.play(ShowCreation(circle)) # Note: ShowCreation, not Create
# Wait
self.wait(1)
# Render and preview
manimgl scene.py MyScene
# Interactive mode - drop into shell at line 15
manimgl scene.py MyScene -se 15
# Write to file
manimgl scene.py MyScene -w
# Low quality for testing
manimgl scene.py MyScene -l
| Feature | ManimGL (3b1b) | Manim Community |
|---|---|---|
| Import | from manimlib import * | from manim import * |
| CLI | manimgl | manim |
| Math text | Tex(R"\pi") | MathTex(r"\pi") |
| Scene | InteractiveScene |
ManimGL's killer feature is interactive development:
# Start at line 20 with state preserved
manimgl scene.py MyScene -se 20
In interactive mode:
# Copy code to clipboard, then run:
checkpoint_paste() # Run with animations
checkpoint_paste(skip=True) # Run instantly (no animations)
checkpoint_paste(record=True) # Record while running
# Get the camera frame
frame = self.frame
# Reorient in 3D (phi, theta, gamma, center, height)
frame.reorient(45, -30, 0, ORIGIN, 8)
# Animate camera movement
self.play(frame.animate.reorient(60, -45, 0))
# Fix mobjects to stay in screen space during 3D movement
title.fix_in_frame()
# Use raw strings with capital R
formula = Tex(R"\int_0^1 x^2 \, dx = \frac{1}{3}")
# Color mapping with t2c
equation = Tex(
R"E = mc^2",
t2c={"E": BLUE, "m": GREEN, "c": YELLOW}
)
# Isolate substrings for animation
formula = Tex(R"\sum_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^2}{6}")
formula.set_color_by_tex("n", BLUE)
def construct(self):
circle = Circle()
self.play(ShowCreation(circle))
self.embed() # Drops into IPython shell here
self.set_floor_plane("xz") # Makes xy the viewing plane
text = Text("Label")
text.set_backstroke(BLACK, 5) # Black outline behind text
# Install ManimGL
pip install manimgl
# Check installation
manimgl --version
manimgl, not manim (community version)ShowCreation, not CreateTex with capital R raw stringsself.frame directly-se flag for interactive developmentThis skill contains example code adapted from 3Blue1Brown's video repository by Grant Sanderson.
License: CC BY-NC-SA 4.0
See LICENSE.txt for full details.
Weekly Installs
709
Repository
GitHub Stars
669
First Seen
Jan 22, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
claude-code564
gemini-cli483
opencode470
codex465
cursor405
antigravity326
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
103,800 周安装
Dokie AI PPT:AI驱动的专业演示文稿设计工具,支持HTML创意动效
737 周安装
PRD生成器:AI驱动产品需求文档工具,快速创建清晰可执行PRD
737 周安装
Devcontainer 设置技能:一键创建预配置开发容器,集成 Claude Code 和语言工具
739 周安装
Plankton代码质量工具:Claude Code自动格式化与Linter强制执行系统
741 周安装
ML Pipeline专家指南:生产级机器学习流水线架构、编排与自动化部署
741 周安装
Tavily API 网络搜索技能 - AI 优化搜索,获取结构化实时网络数据
742 周安装
Scene |
| Create anim | ShowCreation | Create |
| Camera | self.frame | self.camera.frame |
| Fix in frame | mob.fix_in_frame() | self.add_fixed_in_frame_mobjects(mob) |
| Package | manimgl (PyPI) | manim (PyPI) |