OptionalcameraOptional camera used when rendering this scene.
Whether to clear the scissored region before rendering.
Whether to clip the GL viewport to the element's bounds.
The DOM element this scene tracks.
Whether to expose element-space coordinate helpers via u_elementSize.
OptionalinitializedThe scene graph root passed to the renderer each frame.
The underlying Texture wrapping the HTML capture canvas.
Optionalu_Element dimensions in canvas NDC units (vec2). Only present when
elementSpace: true. Use in a vertex shader to map element-local
coordinates to canvas NDC:
gl_Position = vec4(a_position.xy * u_elementSize + u_origin.zw, a_position.z, 1.0);
The sampler2D uniform pointing at the HTML texture.
The vec2 uniform containing the capture canvas pixel dimensions.
Packed origin uniform (vec4):
.xy — element bottom-left in physical pixels, GL canvas space (Y-up)..zw — element centre in canvas NDC [-1, 1].Element size in physical pixels (vec2).
Elapsed time uniform (float). Increments by delta * 0.00005 per frame.
All auto-updated uniforms, ready to spread into a Program's uniforms option.
Whether to lock the GL viewport to the element's bounds.
Whether the element is currently intersecting the viewport.
The internal 2D <canvas layoutsubtree> that captures the HTML element. Style or position it to enable pointer events on contained form elements.
Disconnects all observers, removes the capture canvas, and restores the
HTML element to document.body if it was moved.
The placeholder <div> (inserted when htmlElement === element) is also
removed.
Converts the element's current bounding rect to GL viewport coordinates.
Canvas height in physical pixels (renderer.dimensions.height * dpr).
Device pixel ratio from the renderer.
GL-space x, y, width, height (all in physical pixels) plus the raw DOMRect.
A ScrollScene variant that renders an arbitrary
HTMLElementinto a GPU texture using the experimental HTML-in-Canvas API and exposes it as two auto-managed uniforms:u_htmlsampler2Du_htmlSizevec2Browser support: requires Chromium with
chrome://flags/#canvas-draw-elementenabled. The class feature-detects the API; if it is absent the uniforms are registered but the texture is never populated.Example