20220808-Manim入门教程

git clone https://github.com/leekunhwee/manim.git

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#假设文件保存为text.py

from manimlib.imports import * #引用包,后续代码该行默认有

#动画执行指令
#python3 -m manim text.py BasicWrite -pl
#最基本的写字
class BasicWrite(Scene):
def construct(self):
#text = TextMobject("Hello, I am dodo")
text = TextMobject("""
text,
$\\frac{a}{d}$, #行内公式
$$a^2+d^2=o^2$$ #自动换行的公式
""")
self.play(Write(text)) #逐个字母写出text内容
#self.add(text) #一次性直接出现所有字母
#self.remove(text) #一次性删除字符串
self.wait(3)

#动画执行指令
#python3 -m manim text.py TextWithPosition -pl
#在不同位置写字
class TextWithPosition(Scene):
def construct(self):
text = TextMobject("Andodo")
text.to_edge(UP)
#text.to_edge(DOWN)
#text.to_edge(Right)
#text.to_edge(LEFT)
#text.to_edge(UP+RIGHT)
#text.to_edge(UP+LEFT)
#text.to_edge(RIGHT+DOWN)
#text.to_edge(LEFT+DOWN)
self.play(Write(text))
self.wait(3)


打赏
  • 版权声明: 本博客所有文章除特别声明外,著作权归作者所有。转载请注明出处!

扫一扫,分享到微信

微信分享二维码
  • Copyrights © 2015-2024 TeX_baitu
  • 访问人数: | 浏览次数:

请我喝杯咖啡吧~