ManimCommunity / manim

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

`align_to` misbehavior after `move_to` #3603

Closed TheCrowned closed 5 months ago

TheCrowned commented 5 months ago

If I align an object to another with align_to, then move it somewhere else with move_to, and finally re-align it to the same initial object with align_to, the last call has no effect.

a = Square()
b = Circle().move_to(RIGHT*3)  # so they're not on top of each other
b.align_to(a, LEFT)
b.move_to(RIGHT*2)
b.align_to(a, LEFT)  # this has no effect

Running Manim 0.18.0.

uwezi commented 5 months ago

I believe you need to supply us with more context, because the following code just works fine:

class align(Scene):
    def construct(self):
        a = Square()
        b = Circle().move_to(RIGHT*3)  # so they're not on top of each other
        self.add(a,b)
        self.wait()
        self.play(b.animate.align_to(a, LEFT))
        self.wait()
        self.play(b.animate.move_to(RIGHT*2))
        self.wait()
        self.play(b.animate.align_to(a, LEFT))
        self.wait()

https://github.com/ManimCommunity/manim/assets/8582807/19c86ce5-494a-42ee-a2a7-9ce9afd4661a

uwezi commented 5 months ago

so does this static code

class align2(Scene):
    def construct(self):
        a = Square()
        b = Circle().move_to(RIGHT*3)  # so they're not on top of each other
        b.align_to(a, LEFT)
        b.move_to(RIGHT*2)
        b.align_to(a, LEFT)
        self.add(a,b)

image

TheCrowned commented 5 months ago

Alright, then it must be something with my particular animation. It's a long chain with other elements. I'll close for now.