以下教程来自:Manim Community v0.16.0.post0

First Manim Code

1
2
3
4
5
6
7
from manim import *

class Scene1(Scene):
def construct(self):
circle Circle()
circle.set_fill(PINK, opacity=0.3)
self.play(Create(circle))

Transforming a square into a circle

1
2
3
4
5
6
7
8
9
10
11
class test02(Scene):
def construct(self):
circle = Circle()
circle.set_fill(PINK, opacity=0.4)

square = Square()
square.rotate(PI/4)

self.play(Create(square))
self.play(Transform(square, circle))
self.play(FadeOut(square))

Positioning Mobjects

1
2
3
4
5
6
7
8
9
10
class SquareAndCircle(Scene):
def construct(self):
circle = Circle()
circle.set_fill(PINK, opacity=0.5)

square = Square()
square.set_fill(BLUE, opacity=0.5)

square.next_to(circle, RIGHT, buff=0.5)
self.play(Create(circle), Create(square))

Next_to

1
square.next_to(circle, RIGHT, buff=0.5)

.animate

1
self.play(square.animate.rotate(PI/4))

可能会有一些奇怪的现象出现