Import
ViewHelper is an addon, and must be imported explicitly, see Installation#Addons.
import { ViewHelper } from 'three/addons/helpers/ViewHelper.js';
Constructor
new ViewHelper( camera : Camera, domElement : HTMLElement )
Constructs a new view helper.
| camera |
The camera whose transformation should be visualized. |
| domElement |
The DOM element that is used to render the view. |
Properties
.animating : boolean (readonly)
Whether the helper is currently animating or not.
Default is false.
.isViewHelper : boolean (readonly)
This flag can be used for type testing.
Default is true.
Methods
.dispose()
Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.
.handleClick( event : PointerEvent ) : boolean
This method should be called when a click or pointer event has happened in the app.
| event |
The event to process. |
- Returns: Whether an intersection with the helper has been detected or not.
.render( renderer : WebGLRenderer | WebGPURenderer )
Renders the helper in a separate view in the bottom-right corner of the viewport.
| renderer |
The renderer. |
.setLabelStyle( font : string, color : string, radius : number )
Sets the label style. Has no effect when the axes are unlabeled.
| font |
The label font. Default is |
| color |
The label color. Default is |
| radius |
The label radius. Default is |
.setLabels( labelX : string | undefined, labelY : string | undefined, labelZ : string | undefined )
Sets labels for each axis. By default, they are unlabeled.
| labelX |
The label for the x-axis. |
| labelY |
The label for the y-axis. |
| labelZ |
The label for the z-axis. |
.update( delta : number )
Updates the helper. This method should be called in the app's animation loop.
| delta |
The delta time in seconds. |