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 source image element.
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 image texture.
The vec2 uniform containing the image's natural 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.
Disconnects the IntersectionObserver. Call when permanently removing
this scene — either directly or via ScrollRenderer.removeScene.
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 automatically loads an
HTMLImageElementinto a GPU texture and exposes it as two additional auto-managed uniforms:u_imagesampler2Du_imageSizevec2If the image has not yet loaded when the constructor runs, both uniforms are updated automatically once the
loadevent fires.Example