@pbroom/color-kit/reactPerformance

AdaptiveQuality

Return value of useAdaptiveQuality.

interfaceimport type { AdaptiveQuality } from '@pbroom/color-kit/react';use-adaptive-quality.ts:31
interface AdaptiveQuality {
  quality: ColorPlaneQualityLevel;
  reportFrame: (frame: AdaptiveQualityFrame) => ColorPlaneQualityLevel;
  reset: () => void;
}

Properties

qualityColorPlaneQualityLevel
Current quality level; pass it to the plane hooks' quality option.
reportFrame(frame: AdaptiveQualityFrame) => ColorPlaneQualityLevel
Records one frame's timing (call it from event handlers, not render) and returns the quality level after adapting. The level drops one step when the rolling average over the last 12 frames is slow and rises one step when it recovers.
reset() => void
Clears the rolling timing window, e.g. at the start of a drag.