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/domImport
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
| Input | Type | Default | Description |
|---|---|---|---|
backdrop | string | None | The 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. |
flow | boolean | false | Lets glass drops ripple like liquid. Held still under reduced motion and low quality. |
optics.ior | number | 1.5 | Refractive index. Higher values bend the backdrop more. |
optics.thickness | number | 40 × thickness preference | Slab height in CSS pixels. Thicker glass bends further. |
optics.bevel | number | 28 × (0.6 + 0.4 × thickness preference) | Width of the curved rim in CSS pixels. |
optics.dispersion | number | 0.15 × thickness preference | How far the rim splits light into colour. 0 turns it off. |
optics.frost | number | 1 | Multiplier on every piece's frost. |
optics.merge | number | 12 | Distance in CSS pixels within which neighbouring pieces melt together. |
optics.specular | number | 1 | Strength of reflections and highlights. |
GlassDrop
glass-drop
| Input | Type | Default | Description |
|---|---|---|---|
merge | number | the scene's optics.merge | This drop's merge distance in CSS pixels. |