BrowseScene

Effects

Glass Scene

A WebGL2 stage where glass pieces melt together and refract one shared image.

Preview

Vitreo

Glass that melts as it meets.

Installation

Install the package once, then import the parts you use into a standalone component.

Install

npm install ngx-vitreo @angular/cdk @floating-ui/dom
Import

import { GlassScene, GlassDrop } from 'ngx-vitreo';

@Component({
  imports: [GlassScene, GlassDrop],
  // ...
})

Usage

Usage

<glass-scene backdrop="/wallpapers/aurora-dark.svg" [optics]="{ merge: 24 }" [flow]="flowing()">
  <glass-drop class="drop drop-large" />
  <glass-drop class="drop drop-small" />
  <glass-panel variant="card">Glass that melts as it meets.</glass-panel>
  <button glassButton variant="prominent">Merge</button>
</glass-scene>

API reference

GlassScene

glass-scene

InputTypeDefaultDescription
backdropstringNoneThe image the glass refracts: a URL, or a CSS url() or var() value. Without it, or --lg-scene-backdrop in CSS, the scene keeps its CSS glass.
backdropSpace'local' | 'viewport''local'local covers the scene with the backdrop; viewport pins it to the viewport, like background-attachment: fixed.
flowbooleanfalseLets glass drops ripple like liquid. Held still under reduced motion and low quality.
optics.iornumber1.5Refractive index. Higher values bend the backdrop more.
optics.thicknessnumber 40 × thickness preference Slab height in CSS pixels. Thicker glass bends further.
optics.bevelnumber 28 × (0.6 + 0.4 × thickness preference) Width of the curved rim in CSS pixels.
optics.dispersionnumber 0.15 × thickness preference How far the rim splits light into colour. 0 turns it off.
optics.frostnumber1Multiplier on every piece's frost.
optics.mergenumber12Distance in CSS pixels within which neighbouring pieces melt together.
optics.specularnumber1Strength of reflections and highlights.

GlassDrop

glass-drop

InputTypeDefaultDescription
mergenumber the scene's optics.merge This drop's merge distance in CSS pixels.