본문 바로가기

Programming/Manim code

[37]Animation's rate_func

반응형
    def graph_rate_func2(self):
        axes = Axes(
            x_axis_config={
                "unit_size": 2,
            }
        )

        funcs = [smooth,linear,rush_into,rush_from,
                 slow_into,double_smooth,there_and_back,there_and_back_with_pause,
                 running_start,wiggle, lingering,exponential_decay,
                 ]
        func_names = ['smooth','linear','rush_into','rush_from',
                      'slow_into','double_smooth','there_and_back','there_and_back_with_pause',
                      'running_start','wiggle', 'lingering','exponential_decay',
                      ]

        def get_obj(name, func):
            graph = axes.get_graph(func, x_min=0, x_max=1, color=YELLOW)
            rect = SurroundingRectangle(graph, color=WHITE)
            text = Text(name, size=0.25, stroke_width=0).next_to(graph,UP,buff=0.3)
            return VGroup(graph,rect,text)

        group = VGroup(*[get_obj(name,func) for name, func in zip(func_names, funcs)])     
        group.arrange_in_grid(4, 3)

        self.add(group)
        self.wait()

 

반응형

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

[39]Indicating  (0) 2020.05.12
[38]Animation: Creation  (0) 2020.05.12
[34]GraphScene  (0) 2020.05.12
[33]NumberPlane  (0) 2020.05.12
[032]Axes  (0) 2020.05.11