[PYTHON] manim's manners

Overview

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

Sample code

from manimlib.imports import *

class test(GraphScene):
	CONFIG = {
		"x_min": -4,
		"x_max": 4,
		"y_min": -2,
		"y_max": 2,
		"graph_origin": ORIGIN,
		"function_color": WHITE,
		"axes_color": BLUE
	}
	def construct(self):
		self.setup_axes(animate = True)
		func_graph = self.get_graph(lambda x: np.cos(x), color = WHITE)
		graph_title = TextMobject("input")
		graph_title.scale(1.5)
		graph_title.to_corner(UP + LEFT)
		func_graph_2 = self.get_graph(lambda x: np.sin(100 * x), color = GREEN)
		graph_title_2 = TextMobject("carrier")
		graph_title_2.scale(1.5)
		graph_title_2.to_corner(UP + LEFT)
		func_graph_3 = self.get_graph(lambda x: (np.cos(x) + 1.0) / 2 * np.sin(100 * x), color = YELLOW)
		graph_title_3 = TextMobject("output")
		graph_title_3.scale(1.5)
		graph_title_3.to_corner(UP + LEFT)
		self.play(ShowCreation(func_graph))
		self.add(graph_title)
		self.wait(1)
		self.remove(func_graph)
		self.play(FadeOut(graph_title))
		self.play(ShowCreation(func_graph_2))
		self.add(graph_title_2)
		self.wait(1)
		self.remove(func_graph_2)
		self.play(FadeOut(graph_title_2))
		self.play(ShowCreation(func_graph_3))
		self.add(graph_title_3)
		self.wait(1)


Generated video

https://www.youtube.com/watch?v=rBfhG_S5bp4

that's all.

Recommended Posts

manim's manners
Manim's method 7
Manim's method 13
Manim's method 2
Manim's method 18
Manim's method 17
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