Effects
Glass Lens
A magnifying bead you drag around; its rim bends whatever lies beneath.
Preview
A closer look at the details.
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 { GlassLens } from 'ngx-vitreo';
@Component({
imports: [GlassLens],
// ...
})Usage
Usage
<glass-lens [size]="116" [zoom]="1.7" [defaultPosition]="{ x: 0.62, y: 0.5 }">
<ng-template>
<div class="my-artwork">A closer look at the details.</div>
</ng-template>
</glass-lens>API reference
GlassLens
glass-lens
| Input | Type | Default | Description |
|---|---|---|---|
<ng-template> | TemplateRef | None | Content to magnify, as a child template. It renders twice, so give it its own background and avoid ids. |
size | number | 160 | Lens diameter in pixels. |
zoom | number | 1.6 | Magnification inside the lens. |
defaultPosition | { x: number; y: number } | { x: 0.5, y: 0.5 } | Starting centre as fractions of the stage's width and height. |
label | string | 'Magnifier' | Accessible name of the lens. |
drift | boolean | false | Moves the lens on its own: over text it reads along each line in turn and back; over anything else it glides across. It waits while held and drifts on after. Reduced motion keeps it still. |
driftDuration | number | 7000 | Milliseconds the drifting lens takes to cross the stage's width. |
decorative | boolean | false | For a lens that only shows off what it passes over, as on a heading: hidden from assistive technology and out of the tab order, and kept wholly on the stage so nothing is cut off. |