Experimental AdvancedOptional ExperimentalcaptureCaptures the current rendered pixels of element into an immutable ElementImage.
Optional ExperimentalclearChrome 155+. Clears the geometry set by HTMLSourceCanvas.updateElementGeometry.
Optional ExperimentalrequestRequests a paint event so the canvas re-snapshots its drawable descendants.
Optional ExperimentalupdateChrome 155+. Tells the browser where element was drawn so it can hit test the element
and report its bounds to assistive technology. WebGL and WebGPU drawing never does this
for you. canvasTransform maps the element's border box, before CSS transforms, to canvas
CSS pixels. Older builds read the element's CSS transform instead.
const canvas = app.canvas as HTMLSourceCanvas;
const { a, b, c, d, tx, ty } = sprite.getGlobalTransform();
const canvasTransform = new DOMMatrix([a, b, c, d, tx, ty]).translate(
-sprite.anchor.x * sprite.texture.width,
-sprite.anchor.y * sprite.texture.height,
);
canvas.updateElementGeometry?.(element, { canvasTransform });
Experimental
The HTMLCanvasElement.getContext() method returns a drawing context on the canvas, or null if the context identifier is not supported, or the canvas has already been set to a different context mode.
Optionaloptions: CanvasRenderingContext2DSettingsExperimental
Optionaloptions: ImageBitmapRenderingContextSettingsExperimental
Optionaloptions: WebGLContextAttributesExperimental
Optionaloptions: WebGLContextAttributesExperimental
Optionaloptions: any
An HTMLCanvasElement extended with the experimental HTML-in-Canvas proposal APIs.
These members only exist in browsers that have the HTML-in-Canvas feature enabled, so they are optional. HTMLSource feature-detects
requestPaint; the HTML-in-Canvas API must be enabled for the texture to upload.Example
See
captureElementImage()returns