interface RVG · Core
RvgClock
interface RvgClock
The animation clock shared by all graphics, available as VisQuill.clock.
In real time (the default), animations follow the browser's frames. In manual mode, time stops and moves only
with RvgClock.advance or RvgClock.advanceFrames, which run the animation frames and update the
DOM before they return. This allows capturing an animation frame by frame, for example for a video. When switching
modes, the time continues where it was; running animations go on without a jump.
Example
VisQuill.clock.useManual();
Animate.point.eased(point, target, 1000);
for (let i = 0; i < 60; i++) {
VisQuill.clock.advanceFrames(1, 60); // one frame at 60 fps
await captureFrame(svg); // your own capture code
}
VisQuill.clock.useRealtime();
Properties
manualreadonly
readonly manual: booleanTrue in manual mode.
nowreadonly
readonly now: numberThe current time in milliseconds.
Methods
advance
advance(ms: number): voidMoves the time forward by ms milliseconds and runs one frame at the new time: animations, reactions, and
DOM updates. Throws when the clock is not in manual mode.
advanceFrames
advanceFrames(count: number, fps: number): voidRuns count frames at fps frames per second, each with RvgClock.advance(1000 / fps).
useManual
useManual(): voidSwitches to manual mode: time stops and moves only with advance and advanceFrames.
useRealtime
useRealtime(): voidSwitches back to real time (the browser's frames); waiting animations continue from the current time.
