InteractiveFps — framework-agnostic burst-aware sliding-window tracker.
Measures FPS only over the most recent activity burst; returns null while idle
so overlays never show a stale or misleading rate.
InteractiveFpsProvider — React context provider that owns (or wraps an
external) InteractiveFps instance and re-renders consumers at a configurable
refreshMs interval.
useFps — hook that subscribes to the current FpsValue snapshot.
useFrameReceiver — hook that returns a stable callback to call each time
a frame arrives; does not itself cause a re-render.
FpsReadout — zero-config overlay component; shows an em dash while idle.
Typical usage inside a viewer component:
// Wrap the subtree that both produces and displays frames. <InteractiveFpsProviderwindowMs={1000}idleThresholdMs={500}refreshMs={250}> <ViewportCanvas/> // calls useFrameReceiver() and notifies on each render <FpsReadout/> // re-renders at most once per refreshMs </InteractiveFpsProvider>
// Inside ViewportCanvas: constframeReceived = useFrameReceiver(); // ... after painting each frame: frameReceived();
FPS tracking for interactive Kaolin viewers.
Key classes / hooks:
nullwhile idle so overlays never show a stale or misleading rate.InteractiveFpsinstance and re-renders consumers at a configurablerefreshMsinterval.Typical usage inside a viewer component: