MANIM : How to scale an arrow without changing its anchor

54 Views Asked by At

I want to scale an arrow and then move it from a dot to a dot. An example is as follows :

class SquareToCircle(Scene):

def construct(self):
     dot1 = Dot(point=RIGHT, color = BLACK)
     dot2 = Dot(point=ORIGIN, color = BLACK)
     line = Line(start=ORIGIN, end=RIGHT, color = BLACK, buff = 0.0, stroke_width = 1, tip_length = 0.5)
     line.add_tip(tip_length = 0.05, tip_width = 0.05)
     self.add_foreground_mobjects(dot1,dot2,line)

     self.wait(1)

     self.play(ScaleInPlace(line, random.uniform(0.2, 1.6)))

     self.wait(1)

     self.play(line.animate.shift(RIGHT))

My problem is that the resulting arrow does not move exactly to the second dot because the scaling has changed its origin and extremity. Is there a way to scale the arrow without changing its origin ?

Thank you in advance !

0

There are 0 best solutions below