Skip to main content

Function: always()

always<M>(mob, methodName, ...args): M

Defined in: src/animation/Always.ts:89

Re-apply a mobject method each frame with fixed arguments.

Adds an updater that calls mob[methodName] with the same arguments on every frame. Use it to keep a property pinned to a fixed value against other updaters that would change it.

Type Parameters​

M​

M extends Mobject

Parameters​

mob​

M

The mobject that owns the method.

methodName​

MethodKeys<M>

The name of a method on mob.

args​

...unknown[]

Zero or more fixed arguments, re-applied every frame.

Returns​

M

mob, for chaining.

Example​

always(dot, 'setX', 2);
// Each frame: dot.setX(2).