Moritz Groß
Moritz Groß

Reputation: 1470

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.

Upvotes: 2

Views: 944

Answers (1)

Yuchen
Yuchen

Reputation: 33036

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

Upvotes: 3

Related Questions