Movement and Rotations

Homotopy

class manimlib.animation.movement.Homotopy(homotopy, mobject, **kwargs)

Homotopy a function from (x, y, z, t) to (x', y', z')

Type: Animation

Parameters
  • homotopy (Function) -- (x,y,z,t)

  • mobject (Mobject) -- TODO

CONFIG parameters

"run_time": 3,
"apply_function_kwargs": {},
class HomotopyExample(Scene):
    def construct(self):
        def plane_wave_homotopy(x, y, z, t):
            norm = get_norm([x, y])
            tau = interpolate(5, -5, t) + norm/FRAME_X_RADIUS
            alpha = sigmoid(tau)
            return [x, y + 0.5*np.sin(2*np.pi*alpha)-t*SMALL_BUFF/2, z]

        mobjects=VGroup(
            TextMobject("Text").scale(3),
            Square(),
        ).arrange_submobjects(RIGHT,buff=2)

        self.add(mobjects)
        self.play(
            *[Homotopy(
                plane_wave_homotopy,
                mob
            ) for mob in mobjects]
        )
        self.wait(0.3)

Complex Homotopy

class manimlib.animation.movement.ComplexHomotopy(complex_homotopy, mobject, **kwargs)

Complex Hootopy a function Cx[0, 1] to C

Type: Homotopy

Parameters
  • homotopy (Function) -- (real,im,t)

  • mobject (Mobject) -- TODO

Phase Flow

class manimlib.animation.movement.PhaseFlow(function, mobject, **kwargs)

Type: Animation

Parameters
  • function (Function) -- TODO

  • mobject (Mobject) -- TODO

CONFIG parameters

"virtual_time": 1,
"rate_func": None,
class PhaseFlowExample(Scene):
    def construct(self):
        def func(t):
            return t*0.5*RIGHT

        mobjects=VGroup(
            TextMobject("Text").scale(3),
            Square(),
        ).arrange_submobjects(RIGHT,buff=2)

        self.play(
            *[PhaseFlow(
                func, mob,
                run_time = 2,
            )for mob in mobjects]
        )

        self.wait()

Move Along Path

class manimlib.animation.movement.MoveAlongPath(mobject, path, **kwargs)

Type: Animation

Parameters
  • mobject (Mobject) -- TODO

  • path (Path) -- TODO

class MoveAlongPathExample(Scene):
    def construct(self):
        line=Line(ORIGIN,RIGHT*FRAME_WIDTH,buff=1)
        line.move_to(ORIGIN)
        dot=Dot()
        dot.move_to(line.get_start())

        self.add(line,dot)
        self.play(
            MoveAlongPath(dot,line)
        )
        self.wait(0.3)

Rotating

class manimlib.animation.rotation.Rotating(mobject, **kwargs)

Type: Animation

Parameters

mobject (Mobject) -- TODO

CONFIG parameters

"axis": OUT,
"radians": TAU,
"run_time": 5,
"rate_func": None,
"in_place": True,
"about_point": None,
"about_edge": None,
class RotatingExample(Scene):
    def construct(self):
        square=Square().scale(2)
        self.add(square)

        self.play(
            Rotating(
                square,
                radians=PI/4,
                run_time=2
            )
        )
        self.wait(0.3)
        self.play(
            Rotating(
                square,
                radians=PI,
                run_time=2,
                axis=RIGHT
            )
        )
        self.wait(0.3)

Rotate

class manimlib.animation.rotation.Rotate(mobject, angle=3.141592653589793, axis=array([0.0, 0.0, 1.0]), **kwargs)

Type: Transform

Parameters
  • mobject (Mobject) -- TODO

  • angle (float) -- Angle of rotation

  • axis (3D array) -- Axis of rotation

CONFIG parameters

"in_place": False,
"about_point": None,
class RotateExample(Scene):
    def construct(self):
        square=Square().scale(2)
        self.add(square)

        self.play(
            Rotate(
                square,
                PI/4,
                run_time=2
            )
        )
        self.wait(0.3)
        self.play(
            Rotate(
                square,
                PI,
                run_time=2,
                axis=RIGHT
            )
        )
        self.wait(0.3)