Class: CanvasRenderer

SQR.CanvasRenderer(the)

new CanvasRenderer(the)

Part of a minimal Canvas 2d rendering engine. The paremeter is a canvas element or a selector (ex. #gl-canvas) can be passed to this function. If omitted a new canvas element will be created and it will be available as the canvas property of the object.

Parameters:
Name Type Description
the HTMLCanvasElement

underlying canvas element

Properties:
Name Type Description
the HTMLCanvasElement

underlying canvas element

Source:

Methods

render(root)

Render the transform tree

Parameters:
Name Type Description
root SQR.Transform2d

the root transform to render

Source:

setSize(w, h, r)

Set the size of the underlying canvas element.

Parameters:
Name Type Description
w Number

the width of the canvas

h Number

the height of the canvas

r Number

the resolution (aka pixel ratio)

Source: