본문 바로가기

Programming/Manim code

[030]FunctionGraph

반응형
class FrunctionGraphTest(MovingCameraScene):
    def construct(self):
        self.add(NumberPlane())

    def simple_func(self):
        graph = FunctionGraph(
            lambda x: 0.5 * x + 1,
            x_min = -5,
            x_max = 5,
            color = YELLOW,
            stroke_width = 6,
        )
        self.play(ShowCreation(graph))

 

 


    def sine_curve(self):
        curve = FunctionGraph(
            lambda t: np.sin(t),
            x_min=-TAU,
            x_max=TAU,
            color=YELLOW,
            stroke_width=6,
        )
        curve.move_to(DR)
        curve.set_width(9)

        equation = TextMobject("moving wave")
        equation.scale(1.5)
        equation.to_edge(UP)
        equation.shift(2 * LEFT)
        arrow = Arrow(
            equation.get_bottom(),
            curve.point_from_proportion(0.15)
        )

        self.play(
            ShowCreation(curve),
            Write(equation, run_time=1),
            GrowArrow(arrow),
        )
        self.wait()

 

 

반응형

'Programming > Manim code' 카테고리의 다른 글

[032]Axes  (0) 2020.05.11
[031]NumberLine  (0) 2020.05.11
[029]ParametricFunction  (0) 2020.05.11
[028]Decimal  (0) 2020.05.11
[027]Ellipse/Annulus/AnnularSector/Sector  (0) 2020.05.11