Optional
options: anyoptional parameters for the renderer
Readonly
GPURendererThe renderer string of the underlying graphics driver.
Readonly
GPUVendorThe vendor string of the underlying graphics driver.
The background color used to clear the main framebuffer. Note: alpha value will be set based on the transparent property of the renderer settings.
The list of active compositors
The current compositor used by the renderer
a reference to the current shader program used by the renderer
The current transformation matrix used for transformations on the overall scene
the default method to sort object ("sorting", "z-buffer")
the requested video size ratio
The WebGL context
true if the current rendering context is valid
sets or returns the shape used to join two line segments where they meet. Out of the three possible values for this property: "round", "bevel", and "miter", only "round" is supported for now in WebGL
sets or returns the thickness of lines for shape drawing (limited to strokeLine, strokePolygon and strokeRect)
Readonly
maxMaximum number of texture unit supported under the current context
The Path2D instance used by the renderer to draw primitives
The renderer renderTarget
the scaling ratio to be applied to the main canvas
The given constructor options
The renderer type : Canvas, WebGL, etc... (override this property with a specific value when implementing a custom renderer)
the vertex buffer used by this WebGL Renderer
The WebGL version used by this renderer (1 or 2)
return the height of the canvas which this renderer draws to
height of the system Canvas
return the width of the canvas which this renderer draws to
width of the system Canvas
add a new compositor to this renderer
a compositor instance
a name uniquely identifying this compositor
Optional
activate: boolean = falsetrue if the given compositor should be set as the active one
Clears the gl context with the given color.
Optional
color: string | Color = "#000000"CSS color.
Optional
opaque: boolean = falseAllow transparency [default] or clear the surface completely [true]
Erase the pixels in the given rectangular area by setting them to transparent black (rgba(0,0,0,0)).
x axis of the coordinate for the rectangle starting point.
y axis of the coordinate for the rectangle starting point.
The rectangle's width.
The rectangle's height.
clip the given region from the original canvas. Once a region is clipped, all future drawing will be limited to the clipped region. You can however save the current region using the save(), and restore it (with the restore() method) any time in the future. (this is an experimental feature !)
x axis of the coordinate for the upper-left corner of the rectangle to start clipping from.
y axis of the coordinate for the upper-left corner of the rectangle to start clipping from.
the width of the rectangle to start clipping from.
the height of the rectangle to start clipping from.
Create a pattern with the specified repetition
Source image to be used as the pattern's image
Define how the pattern should be repeated
the patterned texture created
Draw an image to the gl context
An element to draw into the context.
The X coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
The Y coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
The width of the sub-rectangle of the source image to draw into the destination context. If not specified, the entire rectangle from the coordinates specified by sx and sy to the bottom-right corner of the image is used.
The height of the sub-rectangle of the source image to draw into the destination context.
The X coordinate in the destination canvas at which to place the top-left corner of the source image.
The Y coordinate in the destination canvas at which to place the top-left corner of the source image.
The width to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.
The height to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.
// Position the image on the canvas:
renderer.drawImage(image, dx, dy);
// Position the image on the canvas, and specify width and height of the image:
renderer.drawImage(image, dx, dy, dWidth, dHeight);
// Clip the image and position the clipped part on the canvas:
renderer.drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight);
Draw a pattern within the given rectangle.
Pattern object
x position where to draw the pattern
y position where to draw the pattern
width of the pattern
height of the pattern
Fill an arc at the specified coordinates with given radius, start and end points
arc center point x-axis
arc center point y-axis
arc radius
start angle in radians
end angle in radians
Optional
antiClockwise: boolean = falsedraw arc anti-clockwise
Fill a me.Polygon on the screen
the shape to draw
Draw a filled rectangle at the specified coordinates
x axis of the coordinate for the rectangle starting point.
y axis of the coordinate for the rectangle starting point.
The rectangle's width.
The rectangle's height.
Draw a rounded filled rectangle at the specified coordinates
x axis of the coordinate for the rounded rectangle starting point.
y axis of the coordinate for the rounded rectangle starting point.
The rounded rectangle's width.
The rounded rectangle's height.
The rounded corner's radius.
return a reference to the current render target corresponding canvas which this renderer draws to
Returns the WebGLContext instance for the renderer return a reference to the system 2d Context
the current WebGL context
creates a rectangular path whose starting point is at (x, y) and whose size is specified by width and height.
The x axis of the coordinate for the rectangle starting point.
The y axis of the coordinate for the rectangle starting point.
The rectangle's width.
The rectangle's height.
adds a rounded rectangle to the current path.
The x axis of the coordinate for the rectangle starting point.
The y axis of the coordinate for the rectangle starting point.
The rectangle's width.
The rectangle's height.
adds a scaling transformation to the renderer units horizontally and/or vertically
Scaling factor in the horizontal direction. A negative value flips pixels across the vertical axis. A value of 1 results in no horizontal scaling.
Scaling factor in the vertical direction. A negative value flips pixels across the horizontal axis. A value of 1 results in no vertical scaling
set a blend mode for the given context.
Supported blend mode between Canvas and WebGL remderer :
Optional
mode: string = "normal"blend mode : "normal", "multiply", "lighter", "additive", "screen"
Optional
gl: WebGLRenderingContext = ...a WebGL context
Set the current fill & stroke style color. By default, or upon reset, the value is set to #000000.
css color string.
set the active compositor for this renderer
a compositor name
Optional
shader: any = ...an optional shader program to be used, instead of the default one, when activating the compositor
an instance to the current active compositor
A mask limits rendering elements to the shape and position of the given mask object. If the drawing or rendering area is larger than the mask, only the intersecting part of the renderable will be visible. (Note Mask are not preserved through renderer context save and restore and need so be manually cleared)
set/change the current projection matrix (WebGL only)
the new projection matrix
set a coloring tint for sprite based renderables
the tint color
Optional
alpha: number = tint.alphaan alpha value to be applied to the tint
Reset (overrides) the renderer transformation matrix to the identity one, and then apply the given transformation matrix.
a matrix2d to transform by, or a the a component to multiply the current matrix by
the b component to multiply the current matrix by
the c component to multiply the current matrix by
the d component to multiply the current matrix by
the e component to multiply the current matrix by
the f component to multiply the current matrix by
Sets the WebGL viewport, which specifies the affine transformation of x and y from normalized device coordinates to window coordinates
Optional
x: number = 0x the horizontal coordinate for the lower left corner of the viewport origin
Optional
y: number = 0y the vertical coordinate for the lower left corner of the viewport origin
Optional
w: number = ...the width of viewport
Optional
h: number = ...the height of viewport
Stroke an arc at the specified coordinates with given radius, start and end points
arc center point x-axis
arc center point y-axis
arc radius
start angle in radians
end angle in radians
Optional
antiClockwise: boolean = falsedraw arc anti-clockwise
Optional
fill: boolean = falsealso fill the shape with the current color if true
Stroke an ellipse at the specified coordinates with given radius
ellipse center point x-axis
ellipse center point y-axis
horizontal radius of the ellipse
vertical radius of the ellipse
Optional
fill: boolean = falsealso fill the shape with the current color if true
Stroke a Polygon on the screen with a specified color
the shape to draw
Optional
fill: boolean = falsealso fill the shape with the current color if true
Draw a stroke rectangle at the specified coordinates
x axis of the coordinate for the rectangle starting point.
y axis of the coordinate for the rectangle starting point.
The rectangle's width.
The rectangle's height.
Optional
fill: boolean = falsealso fill the shape with the current color if true
Stroke a rounded rectangle at the specified coordinates
x axis of the coordinate for the rounded rectangle starting point.
y axis of the coordinate for the rounded rectangle starting point.
The rounded rectangle's width.
The rounded rectangle's height.
The rounded corner's radius.
Optional
fill: boolean = falsealso fill the shape with the current color if true
tint the given image or canvas using the given color
the source image to be tinted
the color that will be used to tint the image
Optional
mode: string = "multiply"the composition mode used to tint the image
a new canvas or offscreencanvas (if supported) element representing the tinted image
creates a Blob object representing the last rendered frame
Optional
type: string = "image/png"A string indicating the image format
Optional
quality: numberA Number between 0 and 1 indicating the image quality to be used when creating images using file formats that support lossy compression (such as image/jpeg or image/webp). A user agent will use its default quality value if this option is not specified, or if the number is outside the allowed range.
A Promise returning a Blob object representing the last rendered frame
returns a data URL containing a representation of the last frame rendered
Optional
type: string = "image/png"A string indicating the image format
Optional
quality: numberA Number between 0 and 1 indicating the image quality to be used when creating images using file formats that support lossy compression (such as image/jpeg or image/webp). A user agent will use its default quality value if this option is not specified, or if the number is outside the allowed range.
A Promise returning a string containing the requested data URL.
creates an ImageBitmap object of the last frame rendered (not supported by standard Canvas)
Optional
type: string = "image/png"A string indicating the image format
Optional
quality: numberA Number between 0 and 1 indicating the image quality to be used when creating images using file formats that support lossy compression (such as image/jpeg or image/webp). A user agent will use its default quality value if this option is not specified, or if the number is outside the allowed range.
A Promise returning an ImageBitmap.
Multiply given matrix into the renderer tranformation matrix
a matrix2d to transform by, or a the a component to multiply the current matrix by
the b component to multiply the current matrix by
the c component to multiply the current matrix by
the d component to multiply the current matrix by
the e component to multiply the current matrix by
the f component to multiply the current matrix by
WebGLRenderer.setTransform which will reset the current transform matrix prior to performing the new transformation
adds a translation transformation to the current matrix.
Distance to move in the horizontal direction. Positive values are to the right, and negative to the left.
Distance to move in the vertical direction. Positive values are down, and negative are up.
a WebGL renderer object