Resize the canvas when its CSS size changes. Defaults to true.
canvas?
HTMLCanvasElement
Existing canvas to use; size it with CSS.
container?
HTMLElement
Where a new canvas is appended. Defaults to document.body.
dpr?
number
Fixed pixel ratio. By default follows devicePixelRatio, capped at 2, including when it changes (zoom, moving to another display).
onResize?
(width, height, gl) => void
Called with the new pixel size, once on creation and after every resize.
signal?
AbortSignal
Stops resizing when aborted, and removes the canvas if createContext created it. A canvas you pass in is kept, and so is its context: getContext returns the same one if it's used again (as React's StrictMode does when it remounts).