# Two.CanvasRenderer
Extends: Two.Events
This class is used by Two when constructing with type of Two.Types.canvas. It takes Two.js' scenegraph and renders it to a <canvas />.
# Constructor
| Argument | Description |
|---|---|
| parameters | This object is inherited when constructing a new instance of Two. |
| parameters.domElement | The <canvas /> to draw to. If none given a new one will be constructed. |
| parameters.overdraw | Determines whether the canvas should clear the background or not. Defaults to true. |
| parameters.smoothing | Determines whether the canvas should antialias drawing. Set it to false when working with pixel art. false can lead to better performance, since it would use a cheaper interpolation algorithm. |
# Utils
Two.CanvasRenderer.Utils
A massive object filled with utility functions and properties to render Two.js objects to a <canvas />.
# overdraw
Two.CanvasRenderer.overdraw
Determines whether the canvas clears the background each draw call.
# setSize
Two.CanvasRenderer.setSize
Triggers:
event:resize
| Argument | Description |
|---|---|
| width | The new width of the renderer. |
| height | The new height of the renderer. |
| ratio | The new pixel ratio (pixel density) of the renderer. Defaults to calculate the pixel density of the user's screen. |
Change the size of the renderer.