wtc-gl
    Preparing search index...

    Interface ScrollImageOptions

    Options passed to the ScrollImage constructor.

    interface ScrollImageOptions {
        camera?: Camera;
        clearOnRender?: boolean;
        clipToViewport?: boolean;
        element: HTMLElement;
        elementSpace?: boolean;
        gl: WTCGLRenderingContext;
        image?: HTMLImageElement;
        initializedClass?: string;
        margin?: number;
        onAfterRender?: (delta: number, rect: DOMRect) => void;
        onBeforeRender?: (delta: number, rect: DOMRect) => void;
        scene: Obj;
        useViewport?: boolean;
    }

    Hierarchy (View Summary)

    Index

    Properties

    camera?: Camera

    Optional camera. Defaults to the renderer's orthographic camera if omitted.

    clearOnRender?: boolean

    When 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.

    clipToViewport?: boolean

    When 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.

    element: HTMLElement

    The DOM element this scene is anchored to.

    elementSpace?: boolean

    When 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.

    image?: HTMLImageElement

    The image element to upload as u_image. When omitted, element must be an HTMLImageElement and is used directly.

    initializedClass?: string

    CSS 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.

    margin?: number

    Extra 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.

    0
    
    onAfterRender?: (delta: number, rect: DOMRect) => void

    Called immediately after the scene is rendered each frame.

    onBeforeRender?: (delta: number, rect: DOMRect) => void

    Called immediately before the scene is rendered each frame.

    scene: Obj

    The scene graph root to render.

    useViewport?: boolean

    When 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.