본문 바로가기

Programming/Manim code

[011]Text/TextMobject

반응형

Text Class

        str = ["사과","배", "대추", "감", "먹고 싶다"]
        text = VGroup(*[Text(s, font='J신영복 Regular') for s in str])
        text.arrange(DOWN)
        self.add(text)
        self.wait()

 


TextMobject Class (1)

        tex = TexMobject("a^2","+", "b^2","=","c^2")
        self.add(tex)
        self.wait()

        self.play(
            tex[0].set_color, RED,
            tex[2].set_color, RED,
            tex[4].become, TexMobject("d^2").move_to(tex[4]),
            # Transform(tex[4], TexMobject("d^2").move_to(tex[4])),
            run_time=2,
        )

        self.wait()

 


TextMobject Class (2)

        tex = TexMobject("a^2","+", "b^2","=","c^2")
        self.add(tex)
        self.wait()

        self.play(
            tex[0].set_color, RED,
            tex[2].set_color, RED,
            # tex[4].become, TexMobject("d^2").move_to(tex[4]),
            Transform(tex[4], TexMobject("d^2").move_to(tex[4])),
            run_time=2,
        )

        self.wait()

 

 

반응형

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

[013]Text: Transform  (0) 2020.05.05
[012]TextMobject.set_color/set_color_by_map  (0) 2020.05.05
[010]save_state/restore  (0) 2020.05.05
[008]align_to/arrange/arrange_in_grid  (0) 2020.05.05
[007]mob.get_left/mob.get_right  (0) 2020.05.05