-
Notifications
You must be signed in to change notification settings - Fork 33
/
manim_cast.py
58 lines (47 loc) · 1.35 KB
/
manim_cast.py
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from manimlib.imports import *
class ParabolaGraph(GraphScene):
CONIFG = {
"x_min": -2,
"x_max": 6,
"y_max": 10,
"y_min": -4
}
def construct(self):
self.setup_axes()
f = self.get_graph(lambda x: 0.25 * math.pow(x, 2))
self.play(Write(f))
self.wait()
class NumberLineTest(Scene):
def construct(self):
a = Axes(
x_min=-3,
x_max=3,
y_min=-3,
y_max=3,
axis_config={
"include_tip": False,
}
)
f = ParametricFunction(self.func, t_min=0, t_max=2*PI,
color=BLUE)
self.add(a, f)
def func(self, t):
return [2*math.sin(t), math.cos(t), 0]
class ThreeDGraph(ThreeDScene):
def construct(self):
axis_config = {
"x_min": -5.5,
"x_max": 5.5,
"y_min": -5.5,
"y_max": 5.5,
"z_min": -3.5,
"z_max": 3.5,
}
a = ThreeDAxes(**axis_config)
surface = ParametricSurface(self.sur,u_min=-3, u_max=3, v_min=-3, v_max=3)
self.move_camera(0.8 * np.pi / 2, -0.45 * np.pi)
self.add(a, surface)
self.begin_ambient_camera_rotation(rate=0.04)
self.wait(10)
def sur(self, u, v):
return [u, v, u**2 + v**2]