window.kaolin
    Preparing search index...

    Class InteractiveFps

    Sliding-window FPS tracker tuned for render-on-demand viewers.

    In a continuous-render pipeline FPS is just frames / elapsedTime, but interactive viewers only render when something changes (drag, hover, server push) so frame arrivals come in bursts separated by arbitrarily long idle gaps. A naive moving average would drag the reported rate toward zero during those gaps even though the burst itself may have been smooth.

    This class measures FPS only over the most recent windowMs of frame arrivals, and treats any gap longer than idleThresholdMs as the end of the current burst: samples accumulated before the gap are discarded so the next burst's rate isn't polluted by the pre-idle samples. While idle (no frame within idleThresholdMs) getFps returns null so callers can render a neutral indicator (e.g. "—") rather than a stale or zero number.

    Framework-agnostic; React consumers should use InteractiveFpsProvider together with useFps / useFrameReceiver.

    Index

    Constructors

    Methods

    • Record that a frame has just been rendered. If the gap since the previous frame exceeds idleThresholdMs, prior samples are discarded so the new burst is measured in isolation.

      Returns void

    • Current FPS averaged over the sliding window, or null when no rate can be meaningfully reported (fewer than two samples, or currently idle).

      Returns number

    • True iff no frame has arrived within idleThresholdMs.

      Returns boolean

    • Number of frame samples currently retained in the window.

      Returns number

    • Discard all accumulated samples.

      Returns void