class Reactive · Animation

RvgNumberAnimator

Animator for reactive real-number values.

Accessed via Animate.Real. Supports eased tweens, continuous follow, deferred set, and immediate snap operations on reactive Real.

Methods

eased

eased(refObj: Real, to: Real | NumberLike, duration: number, options?: RvgEasedOptions | null): RvgAnimation

Smoothly interpolates the value from its current state to to over the given duration.

A call with a new target starts again from the current value with the full duration (the same target leaves the running animation alone). For a target that changes often, e.g. on every drag move, use Animate.real.follow.

refObj
The reactive Real to animate.
to
The target numeric value.
duration
Animation duration in milliseconds.
options optional
Optional RvgEasedOptions controlling the easing curve, completion tolerance, and an onComplete callback.

Returns The running animation: to cancel it or to wait for it.

follow

follow(refObj: Real, to: Real | NumberLike, options?: RvgFollowOptions | null): RvgAnimation

Continuously moves the value toward to each frame using an exponential decay, producing a lag-based pursuit effect.

The target is read when called. For a target that keeps changing (e.g. during a drag), call follow again with the new target each time: the running animation keeps going and only its target changes, so the motion stays smooth.

refObj
The reactive Real to animate.
to
The target numeric value to follow.
options optional
Optional RvgFollowOptions controlling the follow alpha and snap tolerance.

Returns The running animation: to cancel it or to wait for it.

set

set(refObj: Real, value: Real | NumberLike, delay: number, options?: RvgSetOptions | null): RvgAnimation

Schedules an assignment of value after the given delay, with no interpolation.

refObj
The reactive Real to animate.
value
The value to assign when the delay elapses.
delay
Delay in milliseconds before the assignment occurs.
options optional
Optional RvgSetOptions — currently supports an onComplete callback invoked after the assignment.

Returns The running animation: to cancel it or to wait for it.

snap

snap(refObj: Real, value: Real | NumberLike): void

Immediately cancels any active animation on the value and assigns the new value without delay.

refObj
The reactive Real to update.
value
The value to assign immediately.