0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

manimの作法 その51

Posted at

#概要

manimの作法、調べてみた。
練習問題やってみた。

#参考にしたページ。

#サンプルコード

from manimlib.imports import *

R = 3
e = 0.7
n = 0
u = 0

def f1(t):
	return np.array((e * np.cos(3 * u) + R * np.cos(u + 2 * n * np.pi / 3) + R * np.sqrt(3) * np.cos(u + t), 
					 e * np.sin(3 * u) + R * np.sin(u + 2 * n * np.pi / 3) + R * np.sqrt(3) * np.sin(u + t), 0))
def f2(t):
	return np.array((e * np.cos(3 * t) + R * np.cos(t), 
					 e * np.sin(3 * t) + R * np.sin(t), 0))
def f3(t):
	return np.array((2 * e * np.cos(3 * t), 
					 2 * e * np.sin(3 * t), 0))
def f4(t):
	return np.array((e * np.cos(3 * u) + e * np.cos(3 * t), 
					 e * np.sin(3 * u) + e * np.sin(3 * t), 0))

class test(Scene):
	def construct(self):
		global n, u
		grid = NumberPlane()
		self.add(grid)
		func2 = ParametricFunction(f2, t_min = TAU * 0, t_max = TAU, fill_opacity = 0)
		self.add(func2)
		func3 = ParametricFunction(f3, t_min = TAU * 0, t_max = TAU, fill_opacity = 0)
		self.add(func3)
		self.wait()
		for u in TAU * np.arange(0, 0.4, 1 / 40):
			func4 = ParametricFunction(f4, t_min = TAU * 0, t_max = TAU, stroke_color = PINK, fill_opacity = 0)
			self.add(func4)
			n = 0
			rot0 = ParametricFunction(f1, t_min = np.pi / 6 * (4 * n + 5), t_max = np.pi / 6 * (4 * n + 7), stroke_color = PINK, fill_opacity = 0)
			self.add(rot0)
			n = 1
			rot1 = ParametricFunction(f1, t_min = np.pi / 6 * (4 * n + 5), t_max = np.pi / 6 * (4 * n + 7), stroke_color = PINK, fill_opacity = 0)
			self.add(rot1)
			n = 2
			rot2 = ParametricFunction(f1, t_min = np.pi / 6 * (4 * n + 5), t_max = np.pi / 6 * (4 * n + 7), stroke_color = PINK, fill_opacity = 0)
			self.add(rot2)
			self.wait()
			self.remove(rot0)
			self.remove(rot1)
			self.remove(rot2)
			self.remove(func4)





#生成した動画。

以上。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?