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の作法 その20

Posted at

#概要

manimの作法、調べてみた。
MovingCameraScene使ってみた。

#サンプルコード

from manimlib.imports import *

class test(GraphScene, MovingCameraScene):
	def setup(self):
		GraphScene.setup(self)
		MovingCameraScene.setup(self)
	def construct(self):
		self.camera_frame.save_state()
		self.setup_axes(animate = False)
		graph = self.get_graph(lambda x: np.sin(x), color = BLUE, x_min = 0, x_max = 3 * PI)
		moving_dot = Dot().move_to(graph.points[0]).set_color(ORANGE)
		dot_at_start_graph = Dot().move_to(graph.points[0])
		dot_at_end_grap = Dot().move_to(graph.points[-1])
		self.add(graph, dot_at_end_grap, dot_at_start_graph, moving_dot)
		self.play(self.camera_frame.scale, 0.5, self.camera_frame.move_to, moving_dot)
		def update_curve(mob):
			mob.move_to(moving_dot.get_center())
		self.camera_frame.add_updater(update_curve)
		self.play(MoveAlongPath(moving_dot, graph, rate_func = linear))
		self.camera_frame.remove_updater(update_curve)
		self.play(Restore(self.camera_frame))


#生成した動画

以上。

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?