[PYTHON] Manim's method 20

Overview

I checked manim's method. I tried using MovingCameraScene.

Sample code

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))


Generated video

https://www.youtube.com/watch?v=63cCz1Rou3Q

that's all.

Recommended Posts

Manim's method 7
Manim's method 13
Manim's method 2
Manim's method 18
Manim's method 5
Manim's method 3
Manim's method 15
Manim's method 11
Manim's method 16
Manim's method 20
Manim's method 10
Manim's method 9
Manim's method 6
Manim's method 21
Manim's method 4
Manim's method 8
Manim's method 14
Manim's method 22
Manim's method 19
Manim's method 12
Manim's method part 23
manim's manners
Binary method
Special method
Special method
Understand k-means method
Clustering of clustering method
Dictionary items method
[PyTorch] Installation method
N cross method
Image collection method
Regression analysis method
Gradient method implementation 1
Python-peewee connection method
Class method static method
youtube-dl update method
Monte Carlo method
Mode-Matching Method Simulation_Python
Johnson method (python)
[Python] Semi-Lagrange method