class Reactive · Animation

Animate

Central animation controller for all reactive value types.

Animate is the main entry point for driving animations in the RVG system. It exposes one typed animator per supported value kind, each of which offers a consistent set of animation modes:

  • Eased — interpolates from the current value to a target over a fixed duration, with a configurable easing curve.
  • Follow — continuously pursues a target value each frame using exponential decay (not available for Bool).
  • Set — assigns a value after a fixed delay with no interpolation.
  • Snap — cancels any running animation and assigns a value immediately.

Only one animation can be active per reactive object at a time. Starting a new animation on an object automatically cancels any animation already running on it. Use cancel to stop an animation without starting a new one.

Static properties

boolstaticreadonly

static bool: RvgBoolAnimator

Animator for reactive Bool values.

integerstaticreadonly

static integer: RvgIntegerAnimator

Animator for reactive Integer (integer) values.

pinstaticreadonly

static pin: RvgPinAnimator

Animator for reactive Pin values.

pointstaticreadonly

static point: RvgPointAnimator

Animator for reactive Point values.

progressstaticreadonly

static progress: RvgProgressAnimator

Animator for animations of your own: a progress from 0 to 1 over time, passed to your function each frame.

realstaticreadonly

static real: RvgNumberAnimator

Animator for reactive Real (numeric) values.

realArraystaticreadonly

static realArray: RvgRealArrayAnimator

Animator for reactive number arrays (values.realArray): all numbers at once.

shapestaticreadonly

static shape: RvgShapeAnimator

Animator for reactive Shape values.

stringstaticreadonly

static string: RvgStringAnimator

Animator for reactive StringValue values.

Static methods

afterstatic

static after(delay: number, callback: () => void): any

Schedules a callback to be invoked after the given delay.

The callback runs inside the animation frame loop, so it is synchronised with other animations. The returned handle can be passed to Animate.cancel to abort the pending trigger before it fires.

delay
Delay in milliseconds before the callback is invoked.
callback
The action to execute when the delay elapses.

Returns An opaque handle identifying this trigger. Pass it to Animate.cancel to prevent the callback from firing.

cancelstatic

static cancel(refObj: any): void

Cancels any active animation on the given reactive object.

The object's current value is left unchanged at whatever position the animation had reached at the time of cancellation. If no animation is running on refObj, this method is a no-op.

refObj
The reactive object whose animation should be stopped.