import { Instance, SharedRenderer } from './renderer'; /** * Load (and cache) an image. Resolves once the bitmap is decoded and ready. * * Note: we do NOT set `img.crossOrigin` — for same-origin assets that would * trigger an unnecessary CORS preflight that most static dev servers don't * satisfy. Drawing images into a 2D canvas does not taint the canvas if the * image is same-origin. Consumers serving cross-origin images should set * proper CORS headers on their CDN. */ export declare function loadImage(src: string): Promise; export interface RevealStartOptions { /** Image to reveal. */ image: HTMLImageElement; /** Output canvas size (CSS px). Reveal canvas matches the shader canvas. */ cssWidth: number; cssHeight: number; /** Phase scheduler hooks. */ onRevealComplete?: () => void; } export interface RevealState { /** The DOM canvas painted on top of the shader canvas. */ canvas: HTMLCanvasElement; ctx: CanvasRenderingContext2D; /** Per-frame hook invoked after the shader has rendered. Decides what to do * with the overlay this frame (paint mask, hold, fade out, idle). */ afterShaderFrame: (s: SharedRenderer, inst: Instance, nowMs: number) => void; /** Begin a new reveal animation. */ startReveal: (opts: RevealStartOptions) => void; /** Begin the fade-out (hide) phase. */ startHide: (durationMs?: number) => void; /** * Dissolve the currently held image into a sustained "generating" state: * the image is broken into the effect's pixel-cell grid and the cells churn * (pop in/out with the preset's flicker clock) indefinitely while the * shader effect plays through the gaps. No-op unless an image is currently * revealed/held. Ends when `startReveal` (next image) or `startHide` runs. */ startBoil: () => void; /** Force-clear the overlay back to idle. */ clear: () => void; /** True while a reveal/hold/hide is in progress. */ isActive: () => boolean; dispose: () => void; } export interface CreateRevealOptions { /** The DOM canvas overlay (sibling of the shader canvas). */ canvas: HTMLCanvasElement; cssWidth: number; cssHeight: number; /** Shader canvas — its opacity is driven by the reveal so the image * cross-fades over it. */ shaderCanvas: HTMLCanvasElement; } export declare function createReveal(opts: CreateRevealOptions): RevealState; /** Pull a random image from `pool`, never repeating the previous index. */ export declare function pickRandomImage(pool: string[], lastIdx: number): { src: string; idx: number; } | null;