Skip to main content

Function: alwaysShift()

alwaysShift<M>(mob, direction, rate): M

Defined in: src/animation/updaters.ts:54

Continuously shift a mobject along a direction at a fixed rate.

Adds a dt-based updater that shifts mob by dt * rate along the unit direction each frame. The direction is normalized, so only its orientation matters, not its magnitude (CE always_shift).

Type Parameters​

M​

M extends Mobject

Parameters​

mob​

M

The mobject to shift.

direction​

Vector3Tuple = RIGHT

The shift direction; normalized before use. Default RIGHT.

rate​

number = 0.1

Manim units travelled per second. Default 0.1.

Returns​

M

mob, for chaining.

Example​

alwaysShift(square, RIGHT, 5); // drifts right at 5 units/second