[Python] Asynchronously run different animations in manim

Discussão em 'Python' iniciado por Stack, Abril 6, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying run essentially two animations (ref. following code):

    class RelTrain(Scene):
    def construct(self):
    train = Rectangle(height=1, width=4)
    train2 = Rectangle(height=2, width=2)
    train.move_to(np.array([-10,0,0]))
    train2.move_to(np.array([0,0,0]))
    self.add(train, train2)
    self.play(
    train.move_to, np.array([10,0,0]),
    train2.move_to, np.array([15,0,0]),
    run_time=18,
    rate_func=linear,
    )
    self.wait()


    Essentially two rectangles are moving, but I do not want them to begin movement simultaneously. I want train to start moving, and after 2 seconds (train would still be moving at this point since run_time=18), I want train2 to pop up on the screen and begin its motion. I'm not sure how this is done and would appreciate any help.

    Continue reading...

Compartilhe esta Página