Search code examples
pythonanimationmanim

Manim: Change size of text after creation


class Bla(Scene):
  def construct(self):
    t = Text("Hello world")
    self.add(t)
    self.wait()
    t.size = 100
    self.wait(2)

I know that color is a parameter for the constructor, but how can I change this attribute after the text is already created?

For me, running this class leaves the text fixed.


Solution

  • You can use the scale function to resize it after creation:

    class Blah(Scene):
        def construct(self):
            t = Text("Hello world")
            self.add(t)
            self.wait()
            self.play(t.animate.scale(2))
            self.wait(2)
    

    enter image description here