MoveAlongPath#

Qualified name: manim.animation.movement.MoveAlongPath

class MoveAlongPath(mobject=None, *args, use_override=True, **kwargs)[source]#

Bases: Animation

Make one mobject move along the path of another mobject. .. rubric:: Example

Example: MoveAlongPathExample

from manim import *

class MoveAlongPathExample(Scene):
    def construct(self):
        d1 = Dot().set_color(ORANGE)
        l1 = Line(LEFT, RIGHT)
        l2 = VMobject()
        self.add(d1, l1, l2)
        l2.add_updater(lambda x: x.become(Line(LEFT, d1.get_center()).set_color(ORANGE)))
        self.play(MoveAlongPath(d1, l1), rate_func=linear)
class MoveAlongPathExample(Scene):
    def construct(self):
        d1 = Dot().set_color(ORANGE)
        l1 = Line(LEFT, RIGHT)
        l2 = VMobject()
        self.add(d1, l1, l2)
        l2.add_updater(lambda x: x.become(Line(LEFT, d1.get_center()).set_color(ORANGE)))
        self.play(MoveAlongPath(d1, l1), rate_func=linear)

Methods

interpolate_mobject

Interpolates the mobject of the Animation based on alpha value.

Parameters:
  • mobject (Mobject) –

  • path (VMobject) –

  • suspend_mobject_updating (bool | None) –

interpolate_mobject(alpha)[source]#

Interpolates the mobject of the Animation based on alpha value.

Parameters:

alpha (float) – A float between 0 and 1 expressing the ratio to which the animation is completed. For example, alpha-values of 0, 0.5, and 1 correspond to the animation being completed 0%, 50%, and 100%, respectively.

Return type:

None