Import
CSS2DRenderer is an addon, and must be imported explicitly, see Installation#Addons.
import { CSS2DRenderer } from 'three/addons/renderers/CSS2DRenderer.js';
Constructor
new CSS2DRenderer( parameters : CSS2DRenderer~Parameters )
Constructs a new CSS2D renderer.
| parameters |
The parameters. |
Properties
.domElement : HTMLElement
The DOM where the renderer appends its child-elements.
.sortObjects : boolean
Controls whether the renderer assigns z-index values to CSS2DObject DOM elements.
If set to true, z-index values are assigned first based on the renderOrder
and secondly - the distance to the camera. If set to false, no z-index values are assigned.
Default is true.
Methods
.getSize() : Object
Returns an object containing the width and height of the renderer.
- Returns: The size of the renderer.
.render( scene : Object3D, camera : Camera )
Renders the given scene using the given camera.
| scene |
A scene or any other type of 3D object. |
| camera |
The camera. |
.setSize( width : number, height : number )
Resizes the renderer to the given width and height.
| width |
The width of the renderer. |
| height |
The height of the renderer. |
Type Definitions
.Parameters
Constructor parameters of CSS2DRenderer.
|
element
HTMLElement |
A DOM element where the renderer appends its child-elements. If not passed in here, a new div element will be created. |