PumpedFrames
Refresh frames the host pumps: Wardic's frames are the host loop's, so its writes land in the frame
that draws them (a scene's Host loop: three's setAnimationLoop, an XR session's, a game loop).
The host calls PumpedFrames.frame once a frame, before it renders, with the frame's time in
ms, and a loop that draws only on demand asks PumpedFrames.wantsFrame whether Wardic wants
another.
import * as PumpedFrames from "@wardic/object/PumpedFrames"
const frames = PumpedFrames.make()
renderer.setAnimationLoop((time) => {
frames.frame(time)
renderer.render(scene, camera)
})Its exports also name types the module doesn't export: its internal types.
Interfaces
PumpedFrames
Refresh frames the host pumps: core's frame source, and what the host calls.
Extends
unknown<Callback>
Properties
frame
readonly frame: (time) => void;Run the frame: every callback asked for before it, with time in ms, on the same timebase as
now. Call it once a frame, before rendering.
Parameters
time
number
Returns
void
wantsFrame
readonly wantsFrame: () => boolean;Whether a callback waits for the next frame: what a loop that draws on demand checks to go on.
Returns
boolean
Functions
layer()
function layer(frames): Layer<RefreshFrameSource>;frames as the Environment's Refresh frame source.
Parameters
frames
Returns
Layer<RefreshFrameSource>
make()
function make(now?): PumpedFrames;Frames the host pumps. now is the host's steady clock on its frames' timebase, performance.now()
when left out; core's Clock reads it to time a frame whose time repeats the one before.
Parameters
now?
() => number