概要
wslでmanimやってみた。
練習問題やってみた。
練習問題
3dグラフを書け。
成果物
サンプルコード
from manim import *
class ThreeDSurface(Surface):
def __init__(self, ** kwargs):
kwargs = {
"u_range": [-1.5, 1.5],
"v_range": [-1.5, 1.5],
"checkerboard_colors": [GREEN, BLUE],
"fill_opacity": 0.5
}
Surface.__init__(self, self.func, ** kwargs)
def func(self, x, y):
return np.array([x, y, x ** 2 + y ** 2])
class Test(ThreeDScene):
def construct(self):
self.set_camera_orientation(phi = 75 * DEGREES, theta = 30 * DEGREES)
axes = ThreeDAxes()
self.add(axes)
surface = ThreeDSurface()
self.add(surface)
d = Dot(np.array([0, 0, 0]), color = YELLOW)
self.add(d)
self.wait()
self.move_camera(phi = 45 * DEGREES, theta = 30 * DEGREES)
self.begin_ambient_camera_rotation()
self.wait(9)
以上。