3
  1. I can scale a Square mobject as follows with self.play()/Scene.play():

    square = Square(fill_color=RED, fill_opacity=1)
    
    self.play(square.animate.scale(3))
    self.wait(3)
    

    enter image description here

  2. But I cannot achieve the scale behaviour as above using this simple add_updater method. All I get is a blank screen:

    square = Square(fill_color=RED, fill_opacity=1)
    
    def scale_up(mob, dt):
        mob.scale(2*dt)
    
    square.add_updater(scale_up)
    self.add(square)
    self.wait(3)
    

Questions

  1. How can I achieve the behaviour of No 1 above with add_updater, or other updater techniques?

  2. I know that I can successfully animate an item with updater methods - such as doing mobject.shift() - even without using self.play()/Scene.play(). Can the behaviour of No. 1 above be achieved without using the Scene.play() method?

  3. It appears that you can .scale() an object with scene updaters, instead of Mobject updaters. Why?

xax
  • 2,043
  • 4
  • 24
  • 28
  • 2
    It appears that `mob.scale(2*dt)` instantly shrinks your square to almost zero. According to the manual, `dt` is the time in seconds between two frames, a very small number. Using `mob.scale(1.02)` instead slowly increases the size of the square, by two percent at each update iteration, if I understand correctly. – Adrien Dec 23 '22 at 16:39

0 Answers0