manim
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseManim Community - Mathematical Animation Engine
Manim Community - 数学动画引擎
Comprehensive skill set for creating mathematical animations using Manim Community, a Python framework for creating explanatory math videos programmatically, popularized by 3Blue1Brown.
这份全面指南介绍如何使用Manim Community创建数学动画,这是一个由3Blue1Brown推广的Python框架,可通过编程制作数学讲解视频。
When to use
使用场景
Use this skill whenever you are dealing with Manim code to obtain domain-specific knowledge about:
- Creating mathematical animations and visualizations
- Building educational video content programmatically
- Working with geometric shapes and transformations
- Animating LaTeX equations and mathematical formulas
- Creating graphs, charts, and coordinate systems
- Implementing scene-based animation sequences
- Rendering high-quality mathematical diagrams
- Building explanatory visual content for teaching
当你处理Manim代码时,可借助本技能获取以下领域的专业知识:
- 创建数学动画与可视化效果
- 通过编程制作教育视频内容
- 处理几何图形与变换
- 制作LaTeX公式与数学表达式的动画
- 创建图表、图形与坐标系
- 实现基于场景的动画序列
- 渲染高质量数学图表
- 制作教学用的讲解型视觉内容
Core Concepts
核心概念
Manim allows you to create animations using:
- Scenes: Canvas for your animations where you orchestrate mobjects
- Mobjects: Mathematical objects that can be displayed (shapes, text, equations)
- Animations: Transformations applied to mobjects (Write, Create, Transform, FadeIn)
- Transforms: Morphing between different states of mobjects
- LaTeX Integration: Native support for rendering mathematical notation
- Python Simplicity: Use Python to programmatically specify animation behavior
Manim允许你通过以下组件创建动画:
- Scenes(场景):动画的画布,用于编排mobjects
- Mobjects(数学对象):可展示的数学对象(图形、文本、公式)
- Animations(动画):应用于mobjects的变换效果(Write、Create、Transform、FadeIn)
- Transforms(变换):mobjects在不同状态间的变形
- LaTeX Integration(LaTeX集成):原生支持数学符号渲染
- Python Simplicity(Python简易性):使用Python编程定义动画行为
Key Features
核心特性
- Precise mathematical object positioning and transformations
- Native LaTeX rendering for equations and formulas
- Extensive shape library (circles, rectangles, arrows, polygons)
- Coordinate systems and function graphing
- Boolean operations on geometric shapes
- Camera controls and scene management
- High-quality video rendering
- IPython/Jupyter notebook integration
- VS Code extension with live preview
- 精准的数学对象定位与变换
- 原生LaTeX公式与表达式渲染
- 丰富的图形库(圆形、矩形、箭头、多边形)
- 坐标系与函数绘图
- 几何图形的布尔运算
- 相机控制与场景管理
- 高质量视频渲染
- 与IPython/Jupyter笔记本集成
- 带实时预览的VS Code扩展
How to use
使用方法
Read individual rule files for detailed explanations and code examples:
阅读单个规则文件获取详细说明与代码示例:
Core Concepts
核心概念
- references/scenes.md - Creating scenes and organizing animations
- references/mobjects.md - Understanding mathematical objects and shapes
- references/animations.md - Core animation types and techniques
- references/latex.md - Rendering LaTeX equations and formulas
For additional topics including transforms, timing, shapes, coordinate systems, 3D animations, camera movement, and advanced features, refer to the comprehensive Manim Community documentation.
- references/scenes.md - 创建场景与编排动画
- references/mobjects.md - 理解数学对象与图形
- references/animations.md - 核心动画类型与技巧
- references/latex.md - 渲染LaTeX公式与表达式
如需了解变换、时序、图形、坐标系、3D动画、相机移动及高级特性等更多内容,请参考完整的Manim Community文档。
Quick Start Example
快速入门示例
python
from manim import *
class SquareToCircle(Scene):
def construct(self):
# Create a square
square = Square()
square.set_fill(BLUE, opacity=0.5)
# Create a circle
circle = Circle()
circle.set_fill(RED, opacity=0.5)
# Animate square creation
self.play(Create(square))
self.wait(1)
# Transform square into circle
self.play(Transform(square, circle))
self.wait(1)
# Fade out
self.play(FadeOut(square))Render with:
manim -pql script.py SquareToCirclepython
from manim import *
class SquareToCircle(Scene):
def construct(self):
# Create a square
square = Square()
square.set_fill(BLUE, opacity=0.5)
# Create a circle
circle = Circle()
circle.set_fill(RED, opacity=0.5)
# Animate square creation
self.play(Create(square))
self.wait(1)
# Transform square into circle
self.play(Transform(square, circle))
self.wait(1)
# Fade out
self.play(FadeOut(square))渲染命令:
manim -pql script.py SquareToCircleBest Practices
最佳实践
- Inherit from Scene - All animations should be in a class inheriting from Scene
- Use construct() method - Place all animation code inside the construct() method
- Think in layers - Add mobjects to the scene before animating them
- Use self.play() - Animate mobjects using self.play(Animation(...))
- Test with low quality - Use flag for faster preview renders
-ql - Leverage LaTeX - Use Tex() and MathTex() for mathematical notation
- Group related objects - Use VGroup to manage multiple mobjects together
- Preview frequently - Use flag to automatically open rendered videos
-p
- 继承Scene类 - 所有动画应放在继承自Scene的类中
- 使用construct()方法 - 所有动画代码需置于construct()方法内
- 分层思考 - 在动画前将mobjects添加到场景中
- 使用self.play() - 通过self.play(Animation(...))制作mobjects动画
- 低质量测试 - 使用标志实现更快的预览渲染
-ql - 利用LaTeX - 使用Tex()和MathTex()处理数学符号
- 分组相关对象 - 使用VGroup管理多个mobjects
- 频繁预览 - 使用标志自动打开渲染后的视频
-p
Command Line Usage
命令行使用
bash
undefinedbash
undefinedPreview at low quality (fast)
低质量预览(快速)
manim -pql script.py SceneName
manim -pql script.py SceneName
Render at high quality
高质量渲染
manim -pqh script.py SceneName
manim -pqh script.py SceneName
Save last frame as image
将最后一帧保存为图片
manim -s script.py SceneName
manim -s script.py SceneName
Render multiple scenes
渲染多个场景
manim script.py Scene1 Scene2
undefinedmanim script.py Scene1 Scene2
undefinedResources
资源
- Documentation: https://docs.manim.community/
- Repository: https://github.com/ManimCommunity/manim
- Examples Gallery: https://docs.manim.community/en/stable/examples.html
- Discord Community: https://www.manim.community/discord/
- 3Blue1Brown Channel: https://www.youtube.com/c/3blue1brown
- License: MIT
- 文档:https://docs.manim.community/
- 代码仓库:https://github.com/ManimCommunity/manim
- 示例画廊:https://docs.manim.community/en/stable/examples.html
- Discord社区:https://www.manim.community/discord/
- 3Blue1Brown频道:https://www.youtube.com/c/3blue1brown
- 许可证:MIT