Skip to main content

Function: fAlways()

fAlways<M>(mob, methodName, ...argGetters): M

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

Re-apply a mobject method each frame with arguments from live getters.

Adds an updater that calls mob[methodName] with the current value of each getter. Use it to continually set a property from a value that changes over time, for example a ValueTracker.

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.

argGetters​

...() => unknown[]

Zero or more getters; each is called every frame.

Returns​

M

mob, for chaining.

Example​

const tracker = new ValueTracker(0);
fAlways(dot, 'setX', () => tracker.getValue());
// Each frame: dot.setX(tracker.getValue()).