/** * Adapted from Canvas UI by David Haz (DavidHDev). * Source: https://github.com/DavidHDev/canvas-ui * License: MIT + Commons Clause. */ export type RippleTrigger = "click" | "hover" | "none"; export interface RippleOptions { /** Height of the waves (0 to 3). */ amplitude?: number; /** How fast the rings travel outward. 1 is normal speed. */ speed?: number; /** Distance between wave crests in CSS pixels. */ wavelength?: number; /** Number of crests in each wave train (1 to 8). */ rings?: number; /** How quickly the waves lose energy (higher dies faster). */ decay?: number; /** How strongly the waves bend the page content, in CSS pixels. */ refraction?: number; /** Chromatic dispersion splitting colors along the wave slopes (0 to 1). */ dispersion?: number; /** Intensity of the light glints on the wave crests (0 to 2). */ shine?: number; /** What spawns ripples. "click" on press, "hover" also leaves a wake while moving, "none" only ambient. */ trigger?: RippleTrigger; /** Seconds between ambient ripples at random positions. 0 disables them. */ interval?: number; } export interface RippleElements { /** Canvas with layoutsubtree that hosts the HTML content. */ source: HTMLCanvasElement; /** The element inside the source canvas that gets captured. */ content: HTMLElement; /** Canvas the WebGL effect renders to. */ output: HTMLCanvasElement; } export interface RippleInstance { /** Update effect options live. */ setOptions: (options: RippleOptions) => void; /** Spawn a ripple at a position in CSS pixels relative to the element. */ splash: (x: number, y: number, strength?: number) => void; /** Re-read canvas size. Call when the element is resized. */ resize: () => void; /** Stop the loop and release all GPU resources. */ destroy: () => void; } /** * Attributes that turn a canvas into an HTML-in-Canvas host, and the matching * opt-in for the element that gets drawn. */ export interface HtmlInCanvasMarkup { canvas: Record; element: Record; } /** * Chrome 156 renames the experimental boolean `layoutsubtree` to the * standardized `content="drawable"`, and the element handed to * `drawElementImage()` now declares itself with its own `drawable` attribute * (WICG html-in-canvas issue #169). Browsers advertise the new spelling with a * reflected `content` IDL attribute, so the shape is read off the prototype * rather than sniffed from a version string: every release only ever sees the * attribute it understands. */ export declare function htmlInCanvasMarkup(): HtmlInCanvasMarkup; export declare function supportsHtmlInCanvas(): boolean; export declare function createRipple(elements: RippleElements, options?: RippleOptions): RippleInstance | null;