class Reactive · Animation
RvgShapeAnimator
Animator for reactive Shape values.
Accessed via Animate.Shape. Supports morphing between shapes (or arbitrary point lists) via
eased and continuous follow animations. The source and target shapes must have the same number of
points; the animator interpolates each corresponding point pair independently.
Methods
follow
follow(shape: Shape, target: Shape | ShapeLike, options?: RvgFollowOptions | null): RvgAnimationContinuously moves each point of the shape toward the corresponding point in target each
frame, using an exponential decay to produce a lag-based pursuit effect.
shape- The reactive
Shapeto animate. target- The destination shape whose vertices are followed.
optionsoptional- Optional
RvgFollowOptionscontrolling the follow alpha and snap tolerance.
Returns The running animation: to cancel it or to wait for it.
followAll
followAll(shapes: Shape[], targets: Shape[], options?: RvgFollowOptions | null): RvgAnimationLets many shapes follow their targets at once (the target with the same index), as one animation.
options.onComplete is called once, when all shapes have caught up. Calling it again for
moved targets restarts the followers without a jump (see follow). With different list
lengths, the extra shapes or targets are left out.
shapes- The reactive shapes to animate.
targets- The shapes to follow, one per shape.
optionsoptional- Optional alpha, tolerance and onComplete for the whole group.
Returns One animation for all shapes: to cancel them or to wait until all have caught up.
morph
morph(shape: Shape, target: Shape | ShapeLike, duration: number, options?: RvgEasedOptions | null): RvgAnimationSmoothly morphs the shape from its current geometry to match target over the given
duration.
shape- The reactive
Shapeto animate. target- The destination shape. Its vertices are used as the target point set.
duration- Animation duration in milliseconds.
optionsoptional- Optional
RvgEasedOptionscontrolling the easing curve, completion tolerance, and anonCompletecallback.
Returns The running animation: to cancel it or to wait for it.
morphAll
morphAll(shapes: Shape[], targets: Shape[], duration: number, options?: RvgEasedOptions | null): RvgAnimationMorphs many shapes at once, each to the target with the same index, over the given duration, as one animation.
All share the duration and easing; options.stagger delays the start of each shape after the
first by that many milliseconds more. options.onComplete is called once, when the last
shape has arrived. With different list lengths, the extra shapes or targets are left out.
shapes- The reactive shapes to animate.
targets- The destination shapes, one per shape.
duration- The duration of each shape's animation in milliseconds.
optionsoptional- Optional easing, tolerance, stagger and onComplete for the whole group.
Returns One animation for all shapes: to cancel them or to wait for the last one.
trace
trace(line: Polyline, along: Polyline | ShapeLike, duration: number, options?: RvgTraceOptions | null): RvgAnimationDraws a polyline along a route: line shows a growing (or moving) part of along.
By default the line grows from the start of the route to its end, at constant speed along the
route (eased in time). options.from and options.to set the visible part at the start and
at the end as intervals of ratios: from the end (from: [1, 1]), from the middle in both
directions (from: [0.5, 0.5]), erasing (from: [0, 1], to: [1, 1]), or a piece running
along (from: [0, 0.2], to: [0.8, 1]). The line is set to the start state at once. The route
is read every frame, so it may move while it is drawn. The number of vertices of line
changes as it grows. For a polygon, trace Polygons.toPolyline(polygon).
line- The polyline that shows the visible part (for example a polyline visual).
along- The route.
duration- Animation duration in milliseconds.
optionsoptional- Optional visible intervals, easing and onComplete.
Returns The running animation: to cancel it or to wait for it.
