0
0

wslでmanim その14

Posted at

概要

wslでmanimやってみた。
練習問題やってみた。

練習問題

3dグラフを書け。

成果物

Test_ManimCE_v0.18.1.gif

サンプルコード


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)




以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0