ManimCommunity / manim

A community-maintained Python framework for creating mathematical animations.
https://www.manim.community
MIT License
21.02k stars 1.53k forks source link

Updaters get passed wrong mobject during _AnimationBuilder animations #1536

Open AntonBallmaier opened 3 years ago

AntonBallmaier commented 3 years ago

Description of bug / unexpected behavior

Updaters attached to mobjects animated via the .animate property get passed the wrong mobject during that animation:

class AnimateBugTest(Scene):
    def construct(self):
        line = Line(UP * 3, DOWN * 3).align_on_border(LEFT)
        dot1 = Dot(color=RED)
        dot2 = Dot(color=GREEN)
        self.add(line, dot1, dot2)

        line.add_updater(lambda mob: dot1.move_to(mob))
        dot2.add_updater(lambda mob: mob.move_to(line))

        # Animate Line
        self.play(line.animate.align_on_border(RIGHT), run_time=5)
        self.wait()

https://user-images.githubusercontent.com/26899845/118537082-ca0a4400-b74c-11eb-9a0c-633e02413a01.mp4

Expected behavior

The green dot should behave like the red one.

JoelGotsch commented 3 years ago

I would argue that is not a bug, but wrong usage of updaters. Adding an updater line can only animate line, not dot1.