Skip to main content
Glassen exports factories and optional adapters. Each mount owns its rendering resources; caller-provided sources and shared shapes retain their own lifetime.

Entry points

Lens options

Pass these to createGlass(canvas, options), surface.add(element, options) or mount.update(options). await glassDefaults(dark = false) returns the appearance’s refraction, dispersion, shadow, highlights and CSS background string from Rust. Do not duplicate those defaults in a host adapter. createGlass resolves to a mount with update and destroy. createGlassSurface resolves to a surface with add, addContent, stats and destroy. addContent accepts source and appearance. Updates merge into existing options. Destroy methods are idempotent.

Source frame

time is seconds on the surface clock. size, width and height describe CSS dimensions; pixels, pixelWidth and pixelHeight describe physical dimensions. look is a normalized pointer point, reduced reflects reduced-motion preference, and owner identifies the consuming surface resource.

DOM capture

DOM capture observes mutations, resize, image loads and fonts. Canvas pixel writes and CSS-only animation do not produce DOM mutations. Prefer a canvas/GPU source for animation. Captured DOM should still have accessible original content.

ASCII sources

Options are dark, scale, speed, opacity, preset, colored and zoom. Presets are wobbly, moire, mobius, trefoil, sphere, poem, sigils and shards. The surface owns the GPU renderer returned by the source. Keep the bundled ASCII credits when copying these adaptations.