manim
执行文件
manim yourfile.py [className] [-params]
One can also specify the render quality by using the flags -ql
, -qm
, -qh
, or -qk
, for low, medium, high, and 4k quality, respectively.
flag | abbr | function |
---|---|---|
--help | -h | Show the help message and exit |
--output_file OUTPUT_FILE | -o OUTPUT_FILE | Specify the name of the output file |
--preview | -p | Automatically open the saved file once its done |
--show_in_file_browser | -f | Show the output file in the File Browser |
--write_all | -a | Write all the scenes from a file |
--save_last_frame | -s | Save the last frame only (no movie file is generated) |
--save_pngs | -g | Save each frame as a png |
--save_as_gif | -i | Save the video as gif |
--background_color BACKGROUND_COLOR | -c BACKGROUND_COLOR | Specify background color |
--dry_run | Do a dry run (render scenes but generate no output files) | |
--transparent | -t | Render a scene with an alpha channel |
--low_quality | -ql | Render at low quality |
--medium_quality | -qm | Render at medium quality |
--high_quality | -qh | Render at high quality |
--fourk_quality | -qk | Render at 4K quality |
若要在 Jupyter
中使用
%%manim Test1 [CLI options]
Mobject
Mobject
是屏幕中出现的所有物体的超类
通用方法
所有方法以 Mobject.
开头
移动
-
to_edge(edge, buff=)
移动到指定方向及其线性组合
- edge:DIRECTION
- buff:两者的边界距离
-
to_corner(corner, buff=)
移动到四角
- corner:
- buff:两者的边缘的距离
-
move_to(...)
在当前位置移动到对应的位置
参数可以是
- mobject:另一个 Mobject
- aligned_edge:DIRECTION 的线性组合
- coor_mask:numpy 向量,默认为
np.array([1, 1, 1])
-
next_to(mobject, direction, buff=)
移动到指定对象的相对位置
- mobject:另一个 Mobject 对象
- direction:DIRECTION
- buff:两者的边界距离,默认为 0.25
- aligned_edge:对齐的方向
-
align_to(mobject, direction)
与指定对象对齐
- mobject:另一个 Mobject 对象
- direction:DIRECTION
-
shift(aligned_edge)
向自己的垂直方向平移
- aligned_edge:DIRECTION 的线性组合
-
center()
放到画面中心
旋转
-
rotate(angle)
逆时针旋转
- angle:
PI * number
- angle:
-
flip(direction)
按照指定方向翻转 180 度,方向遵循右手定则
- direction:DIRECTION
变形
-
become(mobject)
变成其他图形
- mobject:另一个 Mobject 对象
-
set_color(color)
变色
- color:COLOR
-
set_color_by_gradient(gradient):
text.set_color_by_gradient(BLUE, GREEN)
text[7:12].set_color_by_gradient(BLUE, GREEN)
-
scale(scale_factor)
缩放大小
- scale_factor:缩放倍数
-
fade(drakness=0.5)
变暗
- darkness:暗度