I checked manim's method. I tried using GraphScene.
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)
https://www.youtube.com/watch?v=rBfhG_S5bp4
that's all.
Recommended Posts