%%manim -qm -v WARNING TangentLineExample class TangentLineExample(Scene): def construct(self): self.camera.background_color=WHITE axes = Axes( x_range=[-10, 10, 1], y_range=[-2, 6, 1], tips=True, axis_config={"include_numbers": True}, ) axes.set_color(BLUE) graph=axes.plot(lambda x: x**2,x_range=[-2,2]) graph.set_color(BLUE) c=ValueTracker(1) line_1=always_redraw(lambda: TangentLine(graph,alpha=c.get_value(),length=4,color=MAROON)) p=ValueTracker(0) graph_2=always_redraw(lambda:axes.plot(lambda x: (x-p.get_value())**2,x_range=[-2,4],color=MAROON)) group=VGroup( axes, graph, line_1, graph_2) self.add(group) self.play(Write(group)) #animation self.play(c.animate.set_value(0),run_time=4) self.play(p.animate.set_value(2),run_time=4)
반응형
'html5' 카테고리의 다른 글
change in demand : animation (1) | 2024.12.01 |
---|---|
manim Homotopy (0) | 2024.05.30 |
manim ValueTracker class example (0) | 2024.05.28 |
manim linearTransform example (0) | 2024.05.26 |
manim boolean operation (0) | 2024.05.19 |