class Reactive · Animation
RvgProgressAnimator
Animator for animations of your own: it runs a progress from 0 to 1 over time and calls your function with it each frame; the function decides what to change.
Accessed via Animate.progress. The function is called with 0 at once (when the animation is
started), then once per frame, and with exactly 1 at the end. It runs inside the animation frame
loop, like every other animation. Animate.cancel can't reach it, as there is no animated
object: stop it with cancel on the returned handle.
Methods
eased
eased(duration: number, update: (progress: number) => void, options?: RvgEasedOptions | null): RvgAnimationRuns the progress once from 0 to 1 over the given duration and calls update with it.
duration- Animation duration in milliseconds.
update- Called with the eased progress: 0 at once, then each frame, 1 at the end.
optionsoptional- Optional
RvgEasedOptions: the easing curve and anonCompletecallback (staggerhas no effect here).
Returns The running animation: to cancel it or to wait for it.
repeat
repeat(duration: number, update: (progress: number, cycle: number) => void, options?: RvgRepeatOptions | null): RvgAnimationRuns the progress from 0 to 1 again and again, each cycle over the given duration, and calls
update with it and the number of the cycle.
Without times the animation runs until it is cancelled; its done then resolves with
false. With alternate, every second cycle runs backwards, from 1 to 0. A new cycle starts
where the frame falls, so the end of a cycle (1) is not passed to update exactly, except at
the very end.
duration- Duration of one cycle in milliseconds.
update- Called with the eased progress of the current cycle and the cycle number (0, 1, 2, …).
optionsoptional- Optional
RvgRepeatOptions: the number of cycles, back and forth, the easing of each cycle (linear by default) and anonCompletecallback.
Returns The running animation: to cancel it or to wait for it.
