UNPKG

physics-glass-effects

Version:

Physics-based glass effects using WebGL with real optical science - works with React, Vue, Next.js, and vanilla JS

48 lines 1.72 kB
import { PhysicsGlassConfig, PhysicsGlassAPI, GlassShape, BackgroundPattern, GlassMaterial } from './types'; export declare class PhysicsGlass implements PhysicsGlassAPI { private canvas; private config; private webglState; private animationId; private isDestroyed; private time; private mousePos; private uniforms; private cleanupContextLoss?; private vertexBuffer?; constructor(canvas: HTMLCanvasElement | string, config?: PhysicsGlassConfig); private validateConfig; private init; private setupWebGL; private setupCanvas; private setupEventListeners; private handleMouseMove; private handleMouseLeave; private handleResize; private handleContextLoss; private handleContextRestored; private getShapeIndex; private getPatternIndex; private updateUniforms; private render; setShape(shape: GlassShape): void; setSize(size: number): void; setRefractionIndex(index: number): void; setDispersion(dispersion: number): void; setThickness(thickness: number): void; setBackgroundPattern(pattern: BackgroundPattern): void; setBackgroundTexture(texture: HTMLImageElement | HTMLCanvasElement | string): Promise<void>; setMaterial(material: GlassMaterial | string): void; getMaterials(): GlassMaterial[]; setMousePosition(x: number, y: number): void; enableMouseTracking(enabled: boolean): void; startAnimation(): void; stopAnimation(): void; setAnimationSpeed(speed: number): void; resize(): void; destroy(): void; getConfig(): PhysicsGlassConfig; getCanvas(): HTMLCanvasElement; isWebGLSupported(): boolean; } //# sourceMappingURL=PhysicsGlass.d.ts.map