API 参考:动画(animation)¶
共 76 个类,按字母排序。每个类含中文说明、继承链、参数表与上手示例,API 文档由 autodoc 从 manim v0.21.0 源码自动生成;带完整中文精讲的类见 API 索引。
Add¶
把 Mobject 加入场景播放序列的动画:与其他动画组合时控制「何时真正把对象放上来」,常与 Succession 搭配精排时序。
继承关系¶
参数¶
快速上手¶
self.play(Add(dot))
API 文档¶
- class manim.Add(mobject=None, *args, use_override=True, **kwargs)¶
基类:
Animation- begin() None¶
Begin the animation.
This method is called right as an animation is being played. As much initialization as possible, especially any mobject copying, should live in this method.
- clean_up_from_scene(scene: Scene) None¶
Clean up the
Sceneafter finishing the animation.This includes to
remove()the Animation'sMobjectif the animation is a remover.Parameters¶
- scene
The scene the animation should be cleaned up from.
- finish() None¶
Finish the animation.
This method gets called when the animation is over.
- interpolate(alpha: float) None¶
Set the animation progress.
This method gets called for every frame during an animation.
Parameters¶
- alpha
The relative time to set the animation to, 0 meaning the start, 1 meaning the end.
- update_mobjects(dt: float) None¶
Updates things like starting_mobject, and (for Transforms) target_mobject. Note, since typically (always?) self.mobject will have its updating suspended during the animation, this will do nothing to self.mobject.
AddTextLetterByLetter¶
让 Text 逐字母浮现,每个字母带微小放大效果,模拟打字机输入,可设置每字符耗时。
继承关系¶
参数¶
|
—,Text |
|---|---|
|
False,bool |
|
|
|
|
|
0.1,float |
|
None,float | None |
|
False |
|
True |
快速上手¶
self.play(AddTextLetterByLetter(text))
API 文档¶
- class manim.AddTextLetterByLetter(mobject=None, *args, use_override=True, **kwargs)¶
AddTextWordByWord¶
让 Text 逐词浮现,按空格分词,适合字幕式进场。
继承关系¶
参数¶
|
—,Text |
|---|---|
|
None,float |
|
0.06,float |
快速上手¶
self.play(AddTextWordByWord(text))
API 文档¶
- class manim.AddTextWordByWord(mobject=None, *args, use_override=True, **kwargs)¶
基类:
Succession
AnimatedBoundary¶
围绕 VMobject 持续流动的虚线边界动画,常用于高亮某个对象「正在被讨论」。
继承关系¶
参数¶
|
—,VMobject |
|---|---|
|
[ManimColor('#29ABCA'), Man… |
|
3,float |
|
0.5,float |
|
True,bool |
|
|
|
|
快速上手¶
self.add(AnimatedBoundary(circle))
API 文档¶
- class manim.AnimatedBoundary(vmobject: ~manim.mobject.types.vectorized_mobject.VMobject, colors: ~collections.abc.Sequence[~manim.utils.color.core.ManimColor | int | str | ~numpy._typing._array_like.NDArray[~numpy.int64] | tuple[int, int, int] | ~numpy._typing._array_like.NDArray[~numpy.float64] | tuple[float, float, float] | tuple[int, int, int, int] | tuple[float, float, float, float]] = [ManimColor('#29ABCA'), ManimColor('#9CDCEB'), ManimColor('#236B8E'), ManimColor('#736357')], max_stroke_width: float = 3, cycle_rate: float = 0.5, back_and_forth: bool = True, draw_rate_func: ~manim.utils.rate_functions.RateFunction = <function smooth>, fade_rate_func: ~manim.utils.rate_functions.RateFunction = <function smooth>, **kwargs: ~typing.Any)¶
基类:
VGroup
Animation¶
一切动画的基类。自定义动画时继承它并实现 interpolate():给定 alpha(0 到 1)描述画面状态。
参数¶
|
— |
|---|---|
|
0.0,float |
|
1.0,float |
|
|
|
False,bool |
|
None,str |
|
False,bool |
|
True,bool |
|
False,bool |
|
|
|
True,bool |
快速上手¶
class Fade(Animation):
def interpolate(self, alpha):
self.mobject.set_opacity(alpha)
API 文档¶
- class manim.Animation(mobject=None, *args, use_override=True, **kwargs)¶
基类:
object- begin() None¶
Begin the animation.
This method is called right as an animation is being played. As much initialization as possible, especially any mobject copying, should live in this method.
- clean_up_from_scene(scene: Scene) None¶
Clean up the
Sceneafter finishing the animation.This includes to
remove()the Animation'sMobjectif the animation is a remover.Parameters¶
- scene
The scene the animation should be cleaned up from.
- finish() None¶
Finish the animation.
This method gets called when the animation is over.
- get_all_mobjects() Sequence[Mobject | OpenGLMobject]¶
Get all mobjects involved in the animation.
Ordering must match the ordering of arguments to interpolate_submobject
Returns¶
- Sequence[Mobject]
The sequence of mobjects.
- get_all_mobjects_to_update() list[Mobject]¶
Get all mobjects to be updated during the animation.
Returns¶
- List[Mobject]
The list of mobjects to be updated during the animation.
- get_rate_func() Callable[[float], float]¶
Get the rate function of the animation.
Returns¶
- Callable[[float], float]
The rate function of the animation.
- get_run_time() float¶
Get the run time of the animation.
Returns¶
- float
The time the animation takes in seconds.
- get_sub_alpha(alpha: float, index: int, num_submobjects: int) float¶
Get the animation progress of any submobjects subanimation.
Parameters¶
- alpha
The overall animation progress
- index
The index of the subanimation.
- num_submobjects
The total count of subanimations.
Returns¶
- float
The progress of the subanimation.
- interpolate(alpha: float) None¶
Set the animation progress.
This method gets called for every frame during an animation.
Parameters¶
- alpha
The relative time to set the animation to, 0 meaning the start, 1 meaning the end.
- interpolate_mobject(alpha: float) None¶
Interpolates the mobject of the
Animationbased on alpha value.Parameters¶
- alpha
A float between 0 and 1 expressing the ratio to which the animation is completed. For example, alpha-values of 0, 0.5, and 1 correspond to the animation being completed 0%, 50%, and 100%, respectively.
- is_introducer() bool¶
Test if the animation is an introducer.
Returns¶
- bool
Trueif the animation is an introducer,Falseotherwise.
- is_remover() bool¶
Test if the animation is a remover.
Returns¶
- bool
Trueif the animation is a remover,Falseotherwise.
- classmethod set_default(**kwargs) None¶
Sets the default values of keyword arguments.
If this method is called without any additional keyword arguments, the original default values of the initialization method of this class are restored.
Parameters¶
- kwargs
Passing any keyword argument will update the default values of the keyword arguments of the initialization function of this class.
Examples¶
class ChangeDefaultAnimation(Scene): def construct(self): Rotate.set_default(run_time=2, rate_func=rate_functions.linear) Indicate.set_default(color=None) S = Square(color=BLUE, fill_color=BLUE, fill_opacity=0.25) self.add(S) self.play(Rotate(S, PI)) self.play(Indicate(S)) Rotate.set_default() Indicate.set_default()
- set_name(name: str) Animation¶
Set the name of the animation.
Parameters¶
- name
The new name of the animation.
Returns¶
- Animation
self
- set_rate_func(rate_func: Callable[[float], float]) Animation¶
Set the rate function of the animation.
Parameters¶
- rate_func
The new function defining the animation progress based on the relative runtime (see
rate_functions).
Returns¶
- Animation
self
- set_run_time(run_time: float) Animation¶
Set the run time of the animation.
Parameters¶
- run_time
The new time the animation should take in seconds.
备注
The run_time of an animation should not be changed while it is already running.
Returns¶
- Animation
self
- update_mobjects(dt: float) None¶
Updates things like starting_mobject, and (for Transforms) target_mobject. Note, since typically (always?) self.mobject will have its updating suspended during the animation, this will do nothing to self.mobject.
AnimationGroup¶
把多个动画打包同时播放,可用 lag_ratio 让组内动画依次错开,是最常用的复合动画容器。
继承关系¶
参数¶
|
None |
|---|---|
|
None,float | None |
|
|
|
0,float |
快速上手¶
self.play(AnimationGroup(FadeIn(a), GrowFromCenter(b), lag_ratio=0.5))
API 文档¶
- class manim.AnimationGroup(mobject=None, *args, use_override=True, **kwargs)¶
基类:
Animation- begin() None¶
Begin the animation.
This method is called right as an animation is being played. As much initialization as possible, especially any mobject copying, should live in this method.
- build_animations_with_timings() None¶
Creates a list of triplets of the form (anim, start_time, end_time).
- clean_up_from_scene(scene: Scene) None¶
Clean up the
Sceneafter finishing the animation.This includes to
remove()the Animation'sMobjectif the animation is a remover.Parameters¶
- scene
The scene the animation should be cleaned up from.
- finish() None¶
Finish the animation.
This method gets called when the animation is over.
- get_all_mobjects() Sequence[Mobject | OpenGLMobject]¶
Get all mobjects involved in the animation.
Ordering must match the ordering of arguments to interpolate_submobject
Returns¶
- Sequence[Mobject]
The sequence of mobjects.
- init_run_time(run_time: float | None) float¶
Calculates the run time of the animation, if different from
run_time.Parameters¶
- run_time
The duration of the animation in seconds.
Returns¶
- run_time
The duration of the animation in seconds.
- interpolate(alpha: float) None¶
Set the animation progress.
This method gets called for every frame during an animation.
Parameters¶
- alpha
The relative time to set the animation to, 0 meaning the start, 1 meaning the end.
- update_mobjects(dt: float) None¶
Updates things like starting_mobject, and (for Transforms) target_mobject. Note, since typically (always?) self.mobject will have its updating suspended during the animation, this will do nothing to self.mobject.
ApplyComplexFunction¶
把复变函数作用到每个点的复坐标上,适合做共形变换等复分析可视化。
继承关系¶
参数¶
|
—,types.MethodType |
|---|---|
|
—,Mobject |
快速上手¶
self.play(ApplyComplexFunction(lambda z: z**2, plane))
API 文档¶
- class manim.ApplyComplexFunction(mobject=None, *args, use_override=True, **kwargs)¶
基类:
ApplyMethod
ApplyFunction¶
用任意函数逐点变形 Mobject:先复制再插值到新形状,直观展示函数对图形的变换效果。
继承关系¶
参数¶
|
—,types.MethodType |
|---|---|
|
—,Mobject |
快速上手¶
self.play(ApplyFunction(lambda m: m.shift(UP), mob))
API 文档¶
ApplyMatrix¶
用 2×2 矩阵对平面做线性变换,传入 numpy 矩阵即可,线性代数课的标配。
继承关系¶
参数¶
|
—,np.ndarray |
|---|---|
|
—,Mobject |
|
array([0., 0., 0.]),np.ndarray |
快速上手¶
self.play(ApplyMatrix([[1, 1], [0, 1]], square))
API 文档¶
- class manim.ApplyMatrix(mobject=None, *args, use_override=True, **kwargs)¶
ApplyMethod¶
把任意 Mobject 方法(如 shift、set_color)包装成动画播放,是 mobject.animate 语法的底层实现。
继承关系¶
参数¶
快速上手¶
self.play(ApplyMethod(dot.shift, UP))
API 文档¶
ApplyPointwiseFunction¶
对曲线上每个点应用 R³ 向量函数,比 ApplyFunction 更底层,直接操作点集。
继承关系¶
参数¶
|
—,types.MethodType |
|---|---|
|
—,Mobject |
|
3.0,float |
快速上手¶
self.play(ApplyPointwiseFunction(lambda p: p + UP, line))
API 文档¶
- class manim.ApplyPointwiseFunction(mobject=None, *args, use_override=True, **kwargs)¶
基类:
ApplyMethod
ApplyPointwiseFunctionToCenter¶
以对象中心为原点应用逐点函数,避免整体平移,适合「原地扭曲」效果。
继承关系¶
参数¶
|
—,types.MethodType |
|---|---|
|
—,Mobject |
API 文档¶
ApplyWave¶
让 VMobject 产生沿路径传播的波浪形变,给静态曲线注入流动感。
继承关系¶
参数¶
|
—,Mobject |
|---|---|
|
array([0., 1., 0.]),Vector3DLike |
|
0.2,float |
|
|
|
1,float |
|
1,int |
|
2,float |
快速上手¶
self.play(ApplyWave(sine_curve))
API 文档¶
Blink¶
让 Mobject 快速闪现再恢复,模拟眨眼或提示性闪烁。
继承关系¶
参数¶
|
—,Mobject |
|---|---|
|
0.5,float |
|
0.5,float |
|
1,int |
|
False,bool |
快速上手¶
self.play(Blink(dot))
API 文档¶
- class manim.Blink(mobject=None, *args, use_override=True, **kwargs)¶
基类:
Succession
Broadcast¶
从中心向外扩散一圈圈涟漪的强调动画,类似水波或雷达扩散。
继承关系¶
参数¶
|
—,Mobject |
|---|---|
|
array([0., 0., 0.]),Sequence[float] |
|
5,int |
|
1,float |
|
0,float |
|
0.0,float |
|
True,bool |
|
0.2,float |
|
3,float |
快速上手¶
self.play(Broadcast(dot))
API 文档¶
- class manim.Broadcast(mobject=None, *args, use_override=True, **kwargs)¶
基类:
LaggedStart
ChangeDecimalToValue¶
把 DecimalNumber 从当前值滚动变化到目标值的动画,数字变动平滑自然。
继承关系¶
参数¶
|
—,DecimalNumber |
|---|---|
|
—,int |
快速上手¶
self.play(ChangeDecimalToValue(number, 3.14))
API 文档¶
- class manim.ChangeDecimalToValue(mobject=None, *args, use_override=True, **kwargs)¶
ChangeSpeed¶
包裹一个动画并动态改变其播放速度,speed_func 接收运行进度返回速度倍率。
继承关系¶
参数¶
|
— |
|---|---|
|
—,dict[float, float] |
|
None |
|
True,bool |
API 文档¶
- class manim.ChangeSpeed(mobject=None, *args, use_override=True, **kwargs)¶
基类:
Animation- classmethod add_updater(mobject: Mobject, update_function: Updater, index: int | None = None, call_updater: bool = False)¶
This static method can be used to apply speed change to updaters.
This updater will follow speed and rate function of any
ChangeSpeedanimation that is playing withaffects_speed_updaters=True. By default, updater functions added via the usualMobject.add_updater()method do not respect the change of animation speed.Parameters¶
- mobject
The mobject to which the updater should be attached.
- update_function
The function that is called whenever a new frame is rendered.
- index
The position in the list of the mobject's updaters at which the function should be inserted.
- call_updater
If
True, calls the update function when attaching it to the mobject.
See also¶
- begin() None¶
Begin the animation.
This method is called right as an animation is being played. As much initialization as possible, especially any mobject copying, should live in this method.
- clean_up_from_scene(scene: Scene) None¶
Clean up the
Sceneafter finishing the animation.This includes to
remove()the Animation'sMobjectif the animation is a remover.Parameters¶
- scene
The scene the animation should be cleaned up from.
- finish() None¶
Finish the animation.
This method gets called when the animation is over.
- get_scaled_total_time() float¶
The time taken by the animation under the assumption that the
run_timeis 1.
- interpolate(alpha: float) None¶
Set the animation progress.
This method gets called for every frame during an animation.
Parameters¶
- alpha
The relative time to set the animation to, 0 meaning the start, 1 meaning the end.
- update_mobjects(dt: float) None¶
Updates things like starting_mobject, and (for Transforms) target_mobject. Note, since typically (always?) self.mobject will have its updating suspended during the animation, this will do nothing to self.mobject.
ChangingDecimal¶
持续变化的数字动画:每次显示当前 ValueTracker 的值,配合 updater 可做实时计数。
继承关系¶
参数¶
|
—,DecimalNumber |
|---|---|
|
—,Callable[[float], float] |
|
False,bool |
快速上手¶
number.add_updater(lambda d: d.set_value(tracker.get_value()))
API 文档¶
- class manim.ChangingDecimal(mobject=None, *args, use_override=True, **kwargs)¶
基类:
Animation- interpolate_mobject(alpha: float) None¶
Interpolates the mobject of the
Animationbased on alpha value.Parameters¶
- alpha
A float between 0 and 1 expressing the ratio to which the animation is completed. For example, alpha-values of 0, 0.5, and 1 correspond to the animation being completed 0%, 50%, and 100%, respectively.
Circumscribe¶
在 Mobject 周围画一个强调框(矩形或圆角),默认黄色,用于「注意这里」。
继承关系¶
参数¶
|
—,Mobject |
|---|---|
|
|
|
False,bool |
|
False,bool |
|
0.3,float |
|
0.1,float |
|
ManimColor('#FFFF00'),ParsableManimColor |
|
1,float |
|
4,float |
快速上手¶
self.play(Circumscribe(formula))
API 文档¶
- class manim.Circumscribe(mobject=None, *args, use_override=True, **kwargs)¶
基类:
Succession
ClockwiseTransform¶
ReplacementTransform 的顺时针变体:路径按顺时针方向插值,适合旋转感的形态变化。
继承关系¶
参数¶
|
—,Mobject |
|---|---|
|
—,Mobject |
|
-3.141592653589793,float |
API 文档¶
ComplexHomotopy¶
复同伦动画:随 t 从 0 到 1 把复平面连续变形,复分析可视化的利器。
继承关系¶
参数¶
|
— |
|---|---|
|
—,Mobject |
API 文档¶
CounterclockwiseTransform¶
ReplacementTransform 的逆时针变体,与 ClockwiseTransform 对应。
继承关系¶
参数¶
|
—,Mobject |
|---|---|
|
—,Mobject |
|
3.141592653589793,float |
API 文档¶
Create¶
沿路径绘出 VMobject 的「一笔画」动画,是 ShowPartial 的便捷封装。
继承关系¶
参数¶
|
— |
|---|---|
|
1.0,float |
|
True,bool |
快速上手¶
self.play(Create(circle))
API 文档¶
- class manim.Create(mobject=None, *args, use_override=True, **kwargs)¶
基类:
ShowPartial
CyclicReplace¶
把一组 Mobject 沿环置换:A 移到 B 的位置、B 移到 C……最后回到 A,可循环往复。
继承关系¶
参数¶
快速上手¶
self.play(CyclicReplace(a, b, c))
API 文档¶
DrawBorderThenFill¶
先描边再填充的两段式入场动画,兼具 Create 和 FadeIn 的效果,适合大面积图形。
继承关系¶
参数¶
|
— |
|---|---|
|
2,float |
|
|
|
2,float |
|
None,str |
|
True,bool |
快速上手¶
self.play(DrawBorderThenFill(polygon))
API 文档¶
FadeIn¶
淡入动画。可指定 shift、scale、target_position,让对象从某处「长」进画面,是最常用的入场方式。
继承关系¶
快速上手¶
self.play(FadeIn(mob, shift=UP))
API 文档¶
- class manim.FadeIn(mobject=None, *args, use_override=True, **kwargs)¶
基类:
_Fade
FadeOut¶
淡出动画,出场首选;常配合 target_position 让对象朝某个点消散。
继承关系¶
快速上手¶
self.play(FadeOut(mob))
API 文档¶
- class manim.FadeOut(mobject=None, *args, use_override=True, **kwargs)¶
基类:
_Fade
FadeToColor¶
平滑地把 Mobject 颜色过渡到目标色,set_color 的动画版。
继承关系¶
参数¶
|
—,Mobject |
|---|---|
|
—,str |
快速上手¶
self.play(FadeToColor(circle, RED))
API 文档¶
- class manim.FadeToColor(mobject=None, *args, use_override=True, **kwargs)¶
基类:
ApplyMethod
FadeTransform¶
把一个 Mobject 淡出、另一个淡入并占据其位置与样式,介于替换与交叉淡化之间。
继承关系¶
参数¶
|
—,Mobject |
|---|---|
|
—,Mobject |
|
True,bool |
|
1,int |
API 文档¶
- class manim.FadeTransform(mobject=None, *args, use_override=True, **kwargs)¶
基类:
Transform- begin()¶
Initial setup for the animation.
The mobject to which this animation is bound is a group consisting of both the starting and the ending mobject. At the start, the ending mobject replaces the starting mobject (and is completely faded). In the end, it is set to be the other way around.
- clean_up_from_scene(scene)¶
Clean up the
Sceneafter finishing the animation.This includes to
remove()the Animation'sMobjectif the animation is a remover.Parameters¶
- scene
The scene the animation should be cleaned up from.
- get_all_mobjects() Sequence[Mobject]¶
Get all mobjects involved in the animation.
Ordering must match the ordering of arguments to interpolate_submobject
Returns¶
- Sequence[Mobject]
The sequence of mobjects.
- ghost_to(source, target)¶
Replaces the source by the target and sets the opacity to 0.
If the provided target has no points, and thus a location of [0, 0, 0] the source will simply fade out where it currently is.
FadeTransformPieces¶
FadeTransform 的逐子对象版本:按子对象配对交叉淡化,适合家族整体换形。
继承关系¶
参数¶
|
—,Mobject |
|---|---|
|
—,Mobject |
|
True,bool |
|
1,int |
API 文档¶
- class manim.FadeTransformPieces(mobject=None, *args, use_override=True, **kwargs)¶
-
- begin()¶
Initial setup for the animation.
The mobject to which this animation is bound is a group consisting of both the starting and the ending mobject. At the start, the ending mobject replaces the starting mobject (and is completely faded). In the end, it is set to be the other way around.
- ghost_to(source, target)¶
Replaces the source submobjects by the target submobjects and sets the opacity to 0.
Flash¶
在点或 Mobject 上打出一圈闪光线条的强调动画,视觉焦点效果强。
继承关系¶
参数¶
|
—,Point3DLike | Mobject |
|---|---|
|
0.2,float |
|
12,int |
|
0.1,float |
|
3,int |
|
ManimColor('#FFFF00'),ParsableManimColor |
|
1,float |
|
1.0,float |
快速上手¶
self.play(Flash(point))
API 文档¶
- class manim.Flash(mobject=None, *args, use_override=True, **kwargs)¶
FocusOn¶
暗化全屏、用光圈聚焦目标点的提示动画,讲解时引导视线。
继承关系¶
参数¶
|
—,Point3DLike | Mobject |
|---|---|
|
0.2,float |
|
ManimColor('#888888'),ParsableManimColor |
|
2,float |
快速上手¶
self.play(FocusOn(dot))
API 文档¶
GrowArrow¶
让 Arrow 沿自身方向从头生长出来的动画。
继承关系¶
参数¶
|
—,Arrow |
|---|---|
|
None |
快速上手¶
self.play(GrowArrow(arrow))
API 文档¶
- class manim.GrowArrow(mobject=None, *args, use_override=True, **kwargs)¶
GrowFromCenter¶
从中心向外长大的入场动画,可用于任意 Mobject。
继承关系¶
参数¶
|
—,Mobject |
|---|---|
|
None |
快速上手¶
self.play(GrowFromCenter(square))
API 文档¶
- class manim.GrowFromCenter(mobject=None, *args, use_override=True, **kwargs)¶
GrowFromEdge¶
从指定边缘向对侧生长的入场动画。
继承关系¶
参数¶
|
—,Mobject |
|---|---|
|
—,Vector3DLike |
|
None |
快速上手¶
self.play(GrowFromEdge(dot, LEFT))
API 文档¶
- class manim.GrowFromEdge(mobject=None, *args, use_override=True, **kwargs)¶
GrowFromPoint¶
从指定点向外长大的入场动画,配合 Flash 效果极佳。
继承关系¶
参数¶
|
—,Mobject |
|---|---|
|
—,Point3DLike |
|
None |
快速上手¶
self.play(GrowFromPoint(mob, origin))
API 文档¶
Homotopy¶
同伦动画:传入关于 (x, y, z, t) 的函数,把对象连续形变到目标姿态。
继承关系¶
参数¶
|
— |
|---|---|
|
—,Mobject |
|
3,float |
|
None,dict[str, Any] | None |
快速上手¶
self.play(Homotopy(lambda x, y, z, t: (x, y + t, z), mob))
API 文档¶
Indicate¶
轻推一下目标对象(放大再回弹)的提示动画,比 Circumscribe 更含蓄。
继承关系¶
参数¶
|
—,Mobject |
|---|---|
|
1.2,float |
|
ManimColor('#FFFF00'),ParsableManimColor |
|
|
快速上手¶
self.play(Indicate(formula))
API 文档¶
LaggedStart¶
让一组动画按固定间隔依次启动,start_lag_ratio 控制节奏,是排队式动效的基石。
继承关系¶
参数¶
快速上手¶
self.play(LaggedStart(*[FadeIn(m) for m in group]))
API 文档¶
- class manim.LaggedStart(mobject=None, *args, use_override=True, **kwargs)¶
LaggedStartMap¶
LaggedStart 的函数式版本:对一组对象统一套用同一种动画并按序启动。
继承关系¶
参数¶
|
—,type[Animation] |
|---|---|
|
—,Mobject |
|
None |
|
2,float |
|
0.05,float |
快速上手¶
self.play(LaggedStartMap(FadeIn, group, lag_ratio=0.1))
API 文档¶
- class manim.LaggedStartMap(mobject=None, *args, use_override=True, **kwargs)¶
基类:
LaggedStart
MaintainPositionRelativeTo¶
让 Mobject 在目标对象动画期间保持相对位置,常配合 ApplyFunction 锁定局部位移。
继承关系¶
参数¶
|
—,Mobject |
|---|---|
|
—,Mobject |
API 文档¶
- class manim.MaintainPositionRelativeTo(mobject=None, *args, use_override=True, **kwargs)¶
基类:
Animation- interpolate_mobject(alpha: float) None¶
Interpolates the mobject of the
Animationbased on alpha value.Parameters¶
- alpha
A float between 0 and 1 expressing the ratio to which the animation is completed. For example, alpha-values of 0, 0.5, and 1 correspond to the animation being completed 0%, 50%, and 100%, respectively.
MoveAlongPath¶
让 Mobject 沿给定路径(曲线)运动的动画。
继承关系¶
参数¶
|
—,Mobject |
|---|---|
|
—,VMobject |
|
False,bool |
快速上手¶
self.play(MoveAlongPath(dot, circle))
API 文档¶
- class manim.MoveAlongPath(mobject=None, *args, use_override=True, **kwargs)¶
基类:
Animation- interpolate_mobject(alpha: float) None¶
Interpolates the mobject of the
Animationbased on alpha value.Parameters¶
- alpha
A float between 0 and 1 expressing the ratio to which the animation is completed. For example, alpha-values of 0, 0.5, and 1 correspond to the animation being completed 0%, 50%, and 100%, respectively.
MoveToTarget¶
把 Mobject 移动到其 save_state 的快照位置,与 mob.target / generate_target 配合使用。
继承关系¶
参数¶
快速上手¶
mob.generate_target()
mob.target.shift(RIGHT)
self.play(MoveToTarget(mob))
API 文档¶
PhaseFlow¶
对向量场(如微分方程相图)随时间演化做形变动画,动力系统可视化工具。
继承关系¶
参数¶
|
— |
|---|---|
|
—,Mobject |
|
1,float |
|
False,bool |
|
|
API 文档¶
- class manim.PhaseFlow(mobject=None, *args, use_override=True, **kwargs)¶
基类:
Animation- interpolate_mobject(alpha: float) None¶
Interpolates the mobject of the
Animationbased on alpha value.Parameters¶
- alpha
A float between 0 and 1 expressing the ratio to which the animation is completed. For example, alpha-values of 0, 0.5, and 1 correspond to the animation being completed 0%, 50%, and 100%, respectively.
RemoveTextLetterByLetter¶
AddTextLetterByLetter 的反向动画:Text 逐字母消失。
继承关系¶
参数¶
|
—,Text |
|---|---|
|
False,bool |
|
|
|
|
|
0.1,float |
|
None,float | None |
|
True |
|
False |
|
True |
API 文档¶
- class manim.RemoveTextLetterByLetter(mobject=None, *args, use_override=True, **kwargs)¶
ReplacementTransform¶
把一个 Mobject 原位变形替换为另一个,是最强的「变形」动画,两个对象会融合。
继承关系¶
参数¶
|
—,Mobject |
|---|---|
|
—,Mobject |
快速上手¶
self.play(ReplacementTransform(square, circle))
API 文档¶
Restore¶
让 Mobject 回到 save_state() 保存的状态,常用于「变了再变回去」。
继承关系¶
参数¶
快速上手¶
self.play(Restore(mob))
API 文档¶
- class manim.Restore(mobject=None, *args, use_override=True, **kwargs)¶
基类:
ApplyMethod
Rotate¶
绕指定点旋转对象的动画,angle 为正逆时针。
继承关系¶
参数¶
|
—,Mobject |
|---|---|
|
3.141592653589793,float |
|
array([0., 0., 1.]),Vector3DLike |
|
None,Point3DLike | None |
|
None,Vector3DLike | None |
快速上手¶
self.play(Rotate(square, PI / 2))
API 文档¶
Rotating¶
持续旋转动画:不占用场景时间推进的「边转边讲」,常用于旋转对称演示。
继承关系¶
参数¶
|
—,Mobject |
|---|---|
|
6.283185307179586,float |
|
array([0., 0., 1.]),Vector3DLike |
|
None,Point3DLike | None |
|
None,Vector3DLike | None |
|
5,float |
|
|
快速上手¶
self.add(Rotating(square))
API 文档¶
- class manim.Rotating(mobject=None, *args, use_override=True, **kwargs)¶
基类:
Animation- interpolate_mobject(alpha: float) None¶
Interpolates the mobject of the
Animationbased on alpha value.Parameters¶
- alpha
A float between 0 and 1 expressing the ratio to which the animation is completed. For example, alpha-values of 0, 0.5, and 1 correspond to the animation being completed 0%, 50%, and 100%, respectively.
ScaleInPlace¶
原地缩放的强调动画,set(width=...) 类的动画版本。
继承关系¶
参数¶
|
—,Mobject |
|---|---|
|
—,float |
快速上手¶
self.play(ScaleInPlace(circle, 1.5))
API 文档¶
- class manim.ScaleInPlace(mobject=None, *args, use_override=True, **kwargs)¶
基类:
ApplyMethod
ShowIncreasingSubsets¶
让 VGroup 的子对象逐个显示,适合逐步揭示列表或矩阵元素。
继承关系¶
参数¶
|
—,Mobject |
|---|---|
|
False,bool |
|
|
|
False |
快速上手¶
self.play(ShowIncreasingSubsets(group))
API 文档¶
- class manim.ShowIncreasingSubsets(mobject=None, *args, use_override=True, **kwargs)¶
基类:
Animation- interpolate_mobject(alpha: float) None¶
Interpolates the mobject of the
Animationbased on alpha value.Parameters¶
- alpha
A float between 0 and 1 expressing the ratio to which the animation is completed. For example, alpha-values of 0, 0.5, and 1 correspond to the animation being completed 0%, 50%, and 100%, respectively.
ShowPartial¶
按进度显示路径片段的底层动画,Create 与 Uncreate 的父类,可自定义绘制方向。
继承关系¶
参数¶
API 文档¶
ShowPassingFlash¶
一道亮斑沿路径扫过的「电流」效果动画,time_width 控制亮斑宽度。
继承关系¶
参数¶
|
—,VMobject |
|---|---|
|
0.1,float |
快速上手¶
self.play(ShowPassingFlash(line))
API 文档¶
- class manim.ShowPassingFlash(mobject=None, *args, use_override=True, **kwargs)¶
基类:
ShowPartial
ShowPassingFlashWithThinningStrokeWidth¶
ShowPassingFlash 的变体:扫过时笔画由粗变细,更像真实书写。
继承关系¶
参数¶
|
—,VMobject |
|---|---|
|
10,int |
|
0.1,float |
|
True,bool |
API 文档¶
- class manim.ShowPassingFlashWithThinningStrokeWidth(mobject=None, *args, use_override=True, **kwargs)¶
ShowSubmobjectsOneByOne¶
把 VGroup 子对象按个显示后再按个移除的序列动画,适合对比展示。
继承关系¶
参数¶
|
—,Iterable[Mobject] |
|---|---|
|
|
快速上手¶
self.play(ShowSubmobjectsOneByOne(group))
API 文档¶
- class manim.ShowSubmobjectsOneByOne(mobject=None, *args, use_override=True, **kwargs)¶
ShrinkToCenter¶
向中心收缩消失的出场动画,FadeOut 的动感替代。
继承关系¶
参数¶
快速上手¶
self.play(ShrinkToCenter(mob))
API 文档¶
- class manim.ShrinkToCenter(mobject=None, *args, use_override=True, **kwargs)¶
基类:
ScaleInPlace
SmoothedVectorizedHomotopy¶
Homotopy 的平滑变体:在变换中保持向量场曲线平滑,减少锯齿。
继承关系¶
参数¶
|
— |
|---|---|
|
—,Mobject |
|
3,float |
|
None,dict[str, Any] | None |
API 文档¶
SpinInFromNothing¶
一边旋转一边淡入的复合入场动画。
继承关系¶
参数¶
|
—,Mobject |
|---|---|
|
1.5707963267948966,float |
|
None |
快速上手¶
self.play(SpinInFromNothing(mob))
API 文档¶
- class manim.SpinInFromNothing(mobject=None, *args, use_override=True, **kwargs)¶
SpiralIn¶
让一组子对象沿螺旋轨迹飞入的编排动画,开场集合类内容很出彩。
继承关系¶
参数¶
|
—,Mobject |
|---|---|
|
8,float |
|
0.3 |
快速上手¶
self.play(SpiralIn(group))
API 文档¶
- class manim.SpiralIn(mobject=None, *args, use_override=True, **kwargs)¶
基类:
Animation- interpolate_mobject(alpha: float) None¶
Interpolates the mobject of the
Animationbased on alpha value.Parameters¶
- alpha
A float between 0 and 1 expressing the ratio to which the animation is completed. For example, alpha-values of 0, 0.5, and 1 correspond to the animation being completed 0%, 50%, and 100%, respectively.
Succession¶
把多个动画严格串成一条时间线依次播放,前一个播完才播下一个。
继承关系¶
参数¶
快速上手¶
self.play(Succession(FadeIn(a), FadeOut(a)))
API 文档¶
- class manim.Succession(mobject=None, *args, use_override=True, **kwargs)¶
-
- begin() None¶
Begin the animation.
This method is called right as an animation is being played. As much initialization as possible, especially any mobject copying, should live in this method.
- finish() None¶
Finish the animation.
This method gets called when the animation is over.
- interpolate(alpha: float) None¶
Set the animation progress.
This method gets called for every frame during an animation.
Parameters¶
- alpha
The relative time to set the animation to, 0 meaning the start, 1 meaning the end.
- next_animation() None¶
Proceeds to the next animation.
This method is called right when the active animation finishes.
- update_mobjects(dt: float) None¶
Updates things like starting_mobject, and (for Transforms) target_mobject. Note, since typically (always?) self.mobject will have its updating suspended during the animation, this will do nothing to self.mobject.
Swap¶
让两个 Mobject 交换位置的动画,常带交叉路径。
继承关系¶
参数¶
API 文档¶
- class manim.Swap(mobject=None, *args, use_override=True, **kwargs)¶
TracedPath¶
持续记录某点运动轨迹并实时绘出的「画笔」对象,配 MoveAlongPath 做轨迹可视化。
继承关系¶
参数¶
|
—,Callable |
|---|---|
|
2,float |
|
ManimColor('#FFFFFF') |
|
None,float | None |
快速上手¶
trace = TracedPath(dot.get_center)
self.add(trace)
self.play(MoveAlongPath(dot, circle))
API 文档¶
- class manim.TracedPath(traced_point_func: Callable, stroke_width: float = 2, stroke_color: ManimColor | int | str | NDArray[int64] | tuple[int, int, int] | NDArray[float64] | tuple[float, float, float] | tuple[int, int, int, int] | tuple[float, float, float, float] | None = ManimColor('#FFFFFF'), dissipating_time: float | None = None, **kwargs: Any)¶
基类:
VMobject
Transform¶
把一个 Mobject 平滑变形为另一个的标准变换动画,所有 Transform 家族的基类。
继承关系¶
参数¶
|
—,Mobject | None |
|---|---|
|
None,Mobject | None |
|
None,Callable | None |
|
0,float |
|
array([0., 0., 1.]),np.ndarray |
|
None |
|
False,bool |
快速上手¶
self.play(Transform(square, circle))
API 文档¶
- class manim.Transform(mobject=None, *args, use_override=True, **kwargs)¶
基类:
Animation- begin() None¶
Begin the animation.
This method is called right as an animation is being played. As much initialization as possible, especially any mobject copying, should live in this method.
TransformAnimations¶
把两个动画「对齐」:让第一个动画的结尾状态匹配第二个动画的起点,实现无缝衔接。
继承关系¶
参数¶
|
—,Animation |
|---|---|
|
—,Animation |
|
|
API 文档¶
TransformFromCopy¶
先复制出副本再变形到位的动画,原对象保留,强调「由它推导」的逻辑。
继承关系¶
参数¶
|
—,Mobject |
|---|---|
|
—,Mobject |
快速上手¶
self.play(TransformFromCopy(a, b))
API 文档¶
TransformMatchingShapes¶
按形状相似度在两个 VGroup 间自动配对子对象逐一变形,重构公式、图形的神器。
继承关系¶
参数¶
|
—,Mobject |
|---|---|
|
—,Mobject |
|
False,bool |
|
False,bool |
|
None,dict | None |
快速上手¶
self.play(TransformMatchingShapes(vg1, vg2))
API 文档¶
- class manim.TransformMatchingShapes(mobject=None, *args, use_override=True, **kwargs)¶
TransformMatchingTex¶
TransformMatchingShapes 的 Tex 特化:按 LaTeX 片段配对变形,公式演算的标配。
继承关系¶
参数¶
|
—,Mobject |
|---|---|
|
—,Mobject |
|
False,bool |
|
False,bool |
|
None,dict | None |
快速上手¶
self.play(TransformMatchingTex(eq1, eq2))
API 文档¶
- class manim.TransformMatchingTex(mobject=None, *args, use_override=True, **kwargs)¶
TypeWithCursor¶
打字机动画 + 闪烁光标:Text 逐字输入,末尾跟一个可自定义的光标 Mobject。
继承关系¶
参数¶
|
—,Text |
|---|---|
|
—,Mobject |
|
0.1,float |
|
True,bool |
|
True,bool |
|
0.1,float |
|
False |
|
True |
快速上手¶
self.play(TypeWithCursor(text, cursor))
API 文档¶
- class manim.TypeWithCursor(mobject=None, *args, use_override=True, **kwargs)¶
-
- begin() None¶
Begin the animation.
This method is called right as an animation is being played. As much initialization as possible, especially any mobject copying, should live in this method.
- clean_up_from_scene(scene: Scene) None¶
Clean up the
Sceneafter finishing the animation.This includes to
remove()the Animation'sMobjectif the animation is a remover.Parameters¶
- scene
The scene the animation should be cleaned up from.
- finish() None¶
Finish the animation.
This method gets called when the animation is over.
Uncreate¶
Create 的反向动画:沿路径把图形擦除。
继承关系¶
参数¶
|
— |
|---|---|
|
True,bool |
|
True,bool |
快速上手¶
self.play(Uncreate(circle))
API 文档¶
UntypeWithCursor¶
TypeWithCursor 的反向动画:带光标逐字删除文本。
继承关系¶
参数¶
|
—,Text |
|---|---|
|
None,VMobject | None |
|
0.1,float |
|
True |
|
False |
|
True |
API 文档¶
- class manim.UntypeWithCursor(mobject=None, *args, use_override=True, **kwargs)¶
Unwrite¶
Write 的反向动画:按书写顺序把文本或公式擦除。
继承关系¶
参数¶
|
—,VMobject |
|---|---|
|
|
|
True,bool |
快速上手¶
self.play(Unwrite(text))
API 文档¶
UpdateFromAlphaFunc¶
用 updater 按动画进度 alpha 驱动任意更新逻辑的自定义动画骨架。
继承关系¶
参数¶
|
—,Mobject |
|---|---|
|
—,Callable[[Mobject], Any] |
|
False,bool |
API 文档¶
- class manim.UpdateFromAlphaFunc(mobject=None, *args, use_override=True, **kwargs)¶
-
- interpolate_mobject(alpha: float) None¶
Interpolates the mobject of the
Animationbased on alpha value.Parameters¶
- alpha
A float between 0 and 1 expressing the ratio to which the animation is completed. For example, alpha-values of 0, 0.5, and 1 correspond to the animation being completed 0%, 50%, and 100%, respectively.
UpdateFromFunc¶
在动画时长内对目标持续应用更新函数的自定义动画,适合「边播边算」的场景。
继承关系¶
参数¶
|
—,Mobject |
|---|---|
|
—,Callable[[Mobject], Any] |
|
False,bool |
API 文档¶
- class manim.UpdateFromFunc(mobject=None, *args, use_override=True, **kwargs)¶
基类:
Animation- interpolate_mobject(alpha: float) None¶
Interpolates the mobject of the
Animationbased on alpha value.Parameters¶
- alpha
A float between 0 and 1 expressing the ratio to which the animation is completed. For example, alpha-values of 0, 0.5, and 1 correspond to the animation being completed 0%, 50%, and 100%, respectively.
Wait¶
停顿动画:让时间流逝 nothing 发生(或跑背景动画),self.wait() 的动画版。
继承关系¶
参数¶
|
1,float |
|---|---|
|
None |
|
None,bool | None |
|
|
快速上手¶
self.play(Wait(2))
API 文档¶
- class manim.Wait(mobject=None, *args, use_override=True, **kwargs)¶
基类:
Animation- begin() None¶
Begin the animation.
This method is called right as an animation is being played. As much initialization as possible, especially any mobject copying, should live in this method.
- clean_up_from_scene(scene: Scene) None¶
Clean up the
Sceneafter finishing the animation.This includes to
remove()the Animation'sMobjectif the animation is a remover.Parameters¶
- scene
The scene the animation should be cleaned up from.
- finish() None¶
Finish the animation.
This method gets called when the animation is over.
- interpolate(alpha: float) None¶
Set the animation progress.
This method gets called for every frame during an animation.
Parameters¶
- alpha
The relative time to set the animation to, 0 meaning the start, 1 meaning the end.
- update_mobjects(dt: float) None¶
Updates things like starting_mobject, and (for Transforms) target_mobject. Note, since typically (always?) self.mobject will have its updating suspended during the animation, this will do nothing to self.mobject.
Wiggle¶
让对象来回扭动摇摆的强调动画,适合标记不确定性或活跃状态。
继承关系¶
参数¶
|
—,Mobject |
|---|---|
|
1.1,float |
|
0.06283185307179587,float |
|
6,int |
|
None,Point3DLike | None |
|
None,Point3DLike | None |
|
2,float |
快速上手¶
self.play(Wiggle(mob))
API 文档¶
Write¶
按文字/笔画顺序「书写」文本的动画,Tex、Text 演算推导的标志性入场方式。
继承关系¶
参数¶
|
— |
|---|---|
|
|
|
False,bool |
快速上手¶
self.play(Write(text))
API 文档¶
- class manim.Write(mobject=None, *args, use_override=True, **kwargs)¶
-
- begin() None¶
Begin the animation.
This method is called right as an animation is being played. As much initialization as possible, especially any mobject copying, should live in this method.
- finish() None¶
Finish the animation.
This method gets called when the animation is over.