class Reactive · Animation

RvgPinAnimator

Animator for reactive Pin values.

Accessed via Animate.Pin. A pin encodes both a position and an orientation/scale vector, so animations can optionally be anchored to a fixed point in the parent coordinate system to produce rotation and scale transitions that appear to pivot around that point.

Methods

along

along(pin: Pin, along: Polyline | ShapeLike, duration: number, options?: RvgAlongOptions | null): RvgAnimation

Moves a pin along a route, facing the direction of travel.

By default from the start of the route to its end, at constant speed along the route (eased in time). options.from and options.to are ratios of the route length; with from > to the pin moves backwards. The pin is set to the start position at once. The route is read every frame, so it may move. Use it with Animate.shape.trace and the same duration and easing for a marker at the tip of a drawn line.

pin
The reactive pin to move.
along
The route.
duration
Animation duration in milliseconds.
options optional
Optional start and end ratio, easing and onComplete.

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

eased

eased(refObj: Pin, to: Pin | PinLike, duration: number, options?: RvgEasedOptions | null): RvgAnimation

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

refObj
The reactive Pin to animate.
to
The target pin 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.

easedAll

easedAll(pins: Pin[], targets: Pin[], duration: number, options?: RvgEasedOptions | null): RvgAnimation

Moves many pins at once, each to the target with the same index, as one animation.

All share the duration and easing; options.stagger delays the start of each pin after the first by that many milliseconds more. options.onComplete is called once, when the last pin has arrived. With different list lengths, the extra pins or targets are left out.

pins
The reactive pins to animate.
targets
The target pins, one per pin.
duration
The duration of each pin's animation in milliseconds.
options optional
Optional easing, tolerance, stagger and onComplete for the whole group.

Returns One animation for all pins: to cancel them or to wait for the last one.

easedAt

easedAt(refObj: Pin, to: Pin | PinLike, anchor: Point | VectorLike, duration: number, options?: RvgEasedOptions | null): RvgAnimation

Smoothly interpolates the pin from its current state to to, pivoting the transformation around anchor in the parent coordinate system.

refObj
The reactive Pin to animate.
to
The target pin value.
anchor
A fixed point in the parent coordinate system around which the pin's position, rotation, and scale are interpolated. Useful for animating a group that should appear to spin or scale about a specific on-screen location.
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: Pin, to: Pin | PinLike, options?: RvgFollowOptions | null): RvgAnimation

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

refObj
The reactive Pin to animate.
to
The target pin 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.

followAll

followAll(pins: Pin[], targets: Pin[], options?: RvgFollowOptions | null): RvgAnimation

Lets many pins follow their targets at once (the target with the same index), as one animation.

options.onComplete is called once, when all pins have caught up. Called again for the same pins (new targets), it continues without a jump; the earlier call counts as cancelled. With different list lengths, the extra pins or targets are left out.

pins
The reactive pins to animate.
targets
The pins to follow, one per pin.
options optional
Optional alpha, tolerance and onComplete for the whole group.

Returns One animation for all pins: to cancel them or to wait until all have caught up.

set

set(refObj: Pin, value: Pin | PinLike, delay: number, options?: RvgSetOptions | null): RvgAnimation

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

refObj
The reactive Pin to animate.
value
The pin 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: Pin, value: Pin | PinLike): void

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

The write is performed inside a reactive transaction to ensure that all dependent reactive values update atomically.

refObj
The reactive Pin to update.
value
The pin value to assign immediately.