OptionalcameraOptional camera. Defaults to the renderer's orthographic camera if omitted.
OptionalclearWhen true (default), the renderer clears the scissored region before
drawing this scene. Set to false to composite on top of previously
rendered scenes — useful for particle overlays.
OptionalclipWhen true (default), the renderer clears the scissored region before
drawing this scene. Set to false to composite on top of previously
rendered scenes — useful for particle overlays.
The DOM element this scene is anchored to.
OptionalelementWhen true, exposes a u_elementSize uniform (vec2) that describes
the element's dimensions in canvas NDC units. Use this in your vertex
shader to position geometry in element-local coordinates while keeping
the full canvas clip volume (so rendering can bleed outside the element):
gl_Position = vec4(a_position.xy * u_elementSize + u_origin.zw, a_position.z, 1.0);
A vertex at (0.4, 0) (edge of a width: 0.8 plane) will land 40 % of
the element's width from its centre, regardless of canvas size.
Combine with useViewport: false and clipToViewport: false to allow
rendering beyond the element boundary (e.g. isometric layer bleed).
The GL rendering context from the parent ScrollRenderer.
OptionalhtmlThe element to render as a GPU texture via the HTML-in-Canvas API.
This element will be moved into an internal <canvas layoutsubtree>
managed by ScrollHTML — it will no longer be in its original DOM
position.
When omitted, element is used. If element and htmlElement are the
same node, that node is moved into the capture canvas and element is
replaced in the original DOM by a size-matched placeholder <div> so
that ScrollScene's position tracking continues to work.
OptionalinitializedCSS class added to the element when the scene is successfully registered with a ScrollRenderer (i.e. when WebGL is confirmed working). Useful for revealing content that should only be visible when WebGL is active — hide it by default in CSS, then show it via this class.
OptionalmarginExtra margin (in pixels) applied to all four sides of the viewport when determining whether the element is visible. A positive value keeps the scene active while the element is that many pixels off-screen; a negative value deactivates it before it fully leaves.
Passed directly to IntersectionObserver as rootMargin.
OptionalonCalled immediately after the scene is rendered each frame.
OptionalonCalled immediately before the scene is rendered each frame.
The scene graph root to render.
OptionaluseWhen true (default), the GL viewport is locked to the element's bounds each frame, so all coordinates are relative to the element. When false, the viewport is left unlocked at the renderer level and it's up to you to use the u_origin uniform for element-relative math in your shader.
Options passed to the ScrollHTML constructor.