import type { Uniforms } from "./gl/program.js"; import { type GLRect } from "./gl-rect.js"; import { type Margin, type Rect } from "./rect.js"; import type { Effect, VFXElement, VFXElementIntersection, VFXOptsInner, VFXProps } from "./types.js"; /** * @internal */ export declare class VFXPlayer { #private; constructor(opts: VFXOptsInner, canvas: HTMLCanvasElement); destroy(): void; addElement(element: HTMLElement, opts?: VFXProps, initialCapture?: OffscreenCanvas): Promise; /** * Replace the effect chain on an already-registered effect-path * element. Effects whose reference is unchanged keep their host / * init state; only added/removed effects run init/dispose. Throws * when the element is not registered, lives on the shader path, or * when a *new* effect (not already in the current chain) is already * attached to another element/postEffect on this player. */ updateElementEffects(element: HTMLElement, rawEffect: Effect | readonly Effect[]): Promise; removeElement(element: HTMLElement): void; updateTextElement(element: HTMLElement): Promise; /** * Re-capture an `` whose `src` changed since `add()`. * * Image source textures are uploaded once at `add()` time (only * video / GIF refresh per frame), so this reloads the current `src` * and swaps `e.srcTexture`. No-op for GIFs, which refresh already. */ updateImageElement(element: HTMLImageElement): Promise; updateCanvasElement(element: HTMLCanvasElement): void; updateHICTexture(canvas: HTMLCanvasElement, offscreen: OffscreenCanvas): void; /** * Stop rendering the elements inside `root` and show their plain * content, including ones added under it later. * Returns a function that undoes it. */ freezeInside(root: HTMLElement): () => void; /** Whether the element is frozen by `freezeInside`. */ isFrozen(element: HTMLElement): boolean; /** * Keep rendering the element while it is off screen. * Returns a function that undoes it. */ forceRender(element: HTMLElement): () => void; get maxTextureSize(): number; isPlaying(): boolean; play(): void; /** Current virtual animation time, in seconds. */ get time(): number; /** * Pin the virtual clock to an absolute time (seconds). The next * `render` uses it verbatim, so `setTime(t); render()` is exact — * useful for scrubbing and deterministic snapshots. */ setTime(time: number): void; /** Playback rate: `1` = realtime, `0` = paused, negative = rewind. */ get timeScale(): number; set timeScale(scale: number); stop(): void; render(): void; } /** * Returns if the given rects intersect. * It returns true when the rects are adjacent (= intersection ratio is 0). */ export declare function isRectInViewport(viewport: Rect, rect: Rect): boolean; export declare function parseOverflowOpts(overflow: VFXProps["overflow"]): [isFullScreen: boolean, Margin]; /** * Uniforms for an intermediate pass of a multipass chain. * `resolution` and `offset` give the element rect inside the pass buffer. * Passes with a fixed `size` use the whole buffer. * @internal */ export declare function getIntermediatePassUniforms(elementSize: { width: number; height: number; }, glRect: GLRect, bufferGlRect: GLRect, passSize: readonly [number, number] | undefined, mouse: readonly [number, number], padding: readonly [number, number], pixelRatio: number): { resolution: [number, number]; offset: [number, number]; mouse: [number, number]; }; /** * Update in/out, the legacy `enterTime` / `leaveTime`, and the transition state. * @internal */ export declare function updateIntersection(e: Pick, ratio: number, touching: boolean, now: number): void; /** * Write the intersection uniforms of a shader-path element. * @internal */ export declare function setIntersectionUniforms(uniforms: Uniforms, e: Pick, intersection: number, now: number): void; export declare function parseIntersectionOpts(intersectionOpts: VFXProps["intersection"]): VFXElementIntersection;