Skip to content
Effects, new

Glass Lens

A pane of glass you can pick up, drawn in WebGL.

$149 once · every Pro piece

Customize

It magnifies what is under it, folds the scene in from beyond its rim and splits colour at the edge, with a lit edge toward the light, a Fresnel sheen, a soft contact shadow and a faint accent caustic that shifts as the glass moves. Drag it, throw it, or tap where it should go: it squashes with speed and springs as it lands. It can also follow the pointer, and arrow keys move it. Disc, pill or rounded square, with props for size, refraction, dispersion and magnification. The lens refracts a canvas you paint (or an image), not live DOM; without WebGL it falls back to a CSS backdrop-filter lens over the same scene.

Install

npx shadcn@latest add @obsyde/glass-lens

Needs your licence key · Get Pro

Usage

Import it from where the CLI puts it, or copy the files below by hand.

import { GlassLens } from '@/components/obsyde/ember/glass-lens/GlassLens';

export function Example() {
  return (
    <GlassLens />
  );
}

Files

What you get with Pro: plain React, TypeScript and CSS, with no dependencies.

  • ember/glass-lens/GlassLens.tsxcomponent
  • ember/glass-lens/glass-lens-demo.cssstyles
  • ember/glass-lens/glass-lens.cssstyles
  • ember/glass-lens/GlassLensDemo.tsxdemo
  • ember/fire-kit/gl.tsshared
  • ember/shared/accent.tsshared
  • ember/shared/spring.tsshared
  • ember/shared/ember.cssshared

API

PropTypeDefault
accentAccent'ember' | 'volt' | 'arc''ember'
shapeShape'disc' | 'pill' | 'square''disc'
sizeSize (px)number220
refractionRefractionnumber0.6
dispersionDispersionnumber0.5
magnifyMagnifynumber1.5
followFollow pointerbooleanfalse
sceneScene'specimen' | 'data''specimen'
webglWebGLbooleantrue