@threlte/extras

<PerfMonitor>

Utility component for monitoring basic rendering statistics using three-perf.

Usage

Simply drop in the <PerfMonitor> component as a child of Threlte <Canvas>. The component starts measuring before mainStage and ends after renderStage. Learn more about tasks in threlte here

<Canvas>
  <PerfMonitor
    anchorX={'right'}
    logsPerSecond={30}
  />
  <Scene />
</Canvas>

Component Signature

Props

name
type
required
default
description

actionToCallUI
string
no
If set and given characters are typed in the the tab window, the three-perf dev gui will be shown. Disabled by default (empty string).

anchorX
'left' | 'right'
no
'left'
Stats html element horizontal anchor.

anchorY
'top' | 'bottom'
no
'top'
Stats html element vertical anchor.

backgroundOpacity
number
no
0.7
Stats block background opacity level.

domElement
HTMLElement
no
document.body
Dom element to which stats block will be attached to.

enabled
boolean
no
true
Toggles stats collection.

guiVisible
boolean
no
false
Toggles Three-perf dev gui visiblity.

logsPerSecond
number
no
10
Refresh rate of the logs.

memory
boolean
no
true
Toggles memory info visiblity (geometries, textures, shaders)

scale
number
no
1
Scale of the stats block html element.

showGraph
boolean
no
true
Toggles cpu/gpu/fps graphs rendering.

visible
boolean
no
true
Toggles visibility of the monitor html element. Setting `false` does not stop collection of the stats.