본문 바로가기

Programming/Manim code

[002]mob.to_edge

반응형
    # based on the 'Scene' class
    def construct(self):
        self.to_edge_test()
        # self.to_edge_test(buff=0.5)

    def to_edge_test(self, buff=0):
        text = Text("Hello", font='Arial', stroke_width=1, size=0.4)
        rect = Rectangle(width=0.3, height=text.get_height(),stroke_color=RED)

        group = VGroup(rect,text).arrange(RIGHT)
        group.save_state()
        self.add(group)

        for d in [LEFT,RIGHT,UP,DOWN]:
            self.play(group.to_edge, d, {"buff":buff})
            self.wait()
            group.restore()
        self.remove(group)

 

 


 

    def construct(self):
        # self.to_edge_test()
        self.to_edge_test(buff=0.5)

    def to_edge_test(self, buff=0):
        text = Text("Hello", font='Arial', stroke_width=1, size=0.4)
        rect = Rectangle(width=0.3, height=text.get_height(),stroke_color=RED)

        group = VGroup(rect,text).arrange(RIGHT)
        group.save_state()
        self.add(group)

        for d in [LEFT,RIGHT,UP,DOWN]:
            self.play(group.to_edge, d, {"buff":buff})
            self.wait()
            group.restore()
        self.remove(group)

 

 

반응형

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

[005]mob.shift  (0) 2020.05.05
[004]mob.next_to  (0) 2020.05.05
[003]mob.to_corner  (0) 2020.05.05
[001]mob.move_to  (0) 2020.05.05
about  (0) 2020.05.05