BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/lore-glass/glass

Glass

lore-glass/glass
FreeComponent

A cross-browser liquid-glass lens engine built on SVG feDisplacementMap. Refracts live DOM content through movable lens regions with a circle-profile bezel, dome bulge, chromatic aberration, and baked specular highlights. Ships with a dependency-free motion core (overshoot tweens, springs, rubber-band) for gel-like interactions. Independent implementation of the displacement-map technique described in Aave Labs' 'Building Glass for the Web'.

Live preview

live · rendered by the registry
Rendered by lore-glass on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://loreglasses.com/r/glass.json

Source

registry/default/glass/glass.tsxloreglasses.com/r/glass.json · first 6 KB
1"use client";
2
3import {
4 GlassWebGLRenderer,
5 isRasterChild,
6 webglAvailable,
7} from "@/components/ui/glass-webgl";
8import { cn } from "@/lib/utils";
9import {
10 type ComponentProps,
11 type ReactNode,
12 type RefObject,
13 useCallback,
14 useEffect,
15 useId,
16 useRef,
17 useState,
18 useSyncExternalStore,
19} from "react";
20
21const SLOTS = 5;
22const MAP_CACHE_LIMIT = 64;
23const EDGE_BIAS = 0.5;
24
25interface MapParams {
26 depth: number;
27 domeDepth: number;
28 edgeExponent: number;
29 edgeStrength: number;
30 edgeWidth: number;
31 glowExponent: number;
32 glowSpread: number;
33 glowStrength: number;
34 halfH: number;
35 halfW: number;
36 radius: number;
37 size: number;
38 splay: number;
39 specularAngle: number;
40 sdfBoundary?: boolean;
41 edgeFalloff?: boolean;
42 alphaBlend?: boolean;
43}
44
45interface GlassDynamics {
46 zoom?: number;
47 depthMul?: number;
48 mapDims?: { halfW: number; halfH: number; radius: number };
49}
50
51function clamp01(v: number): number {
52 return v < 0 ? 0 : v > 1 ? 1 : v;
53}
54
55function erf(x: number): number {
56 return Math.tanh(1.7724538509 * x);
57}
58
59function sphereAvgSlope(r: number, halfDim: number): number {
60 let sum = 0;
61 for (let i = 0; i <= 200; i++) {
62 const a = (i / 200) * halfDim;
63 const s = a / Math.sqrt(r * r - a * a);
64 sum += i === 0 || i === 200 ? 0.5 * s : s;
65 }
66 return sum / 200;
67}
68
69interface DomeConstants {
70 rx: number;
71 ry: number;
72 scaleX: number;
73 scaleY: number;
74}
75
76function computeDomeConstants(
77 domeDepth: number,
78 halfW: number,
79 halfH: number
80): DomeConstants {
81 const h = Math.max(0.01, Math.min(domeDepth, Math.min(halfW, halfH) - 1));
82 const rx = (halfW * halfW + h * h) / (2 * h);
83 const ry = (halfH * halfH + h * h) / (2 * h);
84 const ax = sphereAvgSlope(rx, halfW);
85 const ay = sphereAvgSlope(ry, halfH);
86 return {
87 rx,
88 ry,
89 scaleX: ax > 0 ? 0.5 / ax : 1,
90 scaleY: ay > 0 ? 0.5 / ay : 1,
91 };
92}
93
94function domeGradient(p: number, r: number, scale: number): number {
95 const c = Math.min(p, 0.999 * r);
96 return (c / Math.sqrt(r * r - c * c)) * scale;
97}
98
99function generateLensMap(p: MapParams): string | null {
100 if (p.halfW < 2 || p.halfH < 2) {
101 return null;
102 }
103 const sdfBoundary = p.sdfBoundary ?? true;
104 const edgeFalloff = p.edgeFalloff ?? true;
105 const size = p.size;
106 const canvas = document.createElement("canvas");
107 canvas.width = size;
108 canvas.height = size;
109 const ctx = canvas.getContext("2d");
110 if (!ctx) {
111 return null;
112 }
113 const image = ctx.createImageData(size, size);
114// … truncated

Files it writes

  • registry/default/glass/glass.tsx
  • registry/default/glass/glass-motion.ts
  • registry/default/glass/glass-surface.tsx
  • registry/default/glass/glass-webgl.ts

Facts

Registry
lore-glass
Type
registry:ui
Access
Free
Files written
4
Licence
MIT
In the index
at or before 2026-08-08
Last confirmed
today

Go to the source

Docs on lore-glass loreglasses.com Simonstorms/lore-glass on GitHub Raw registry item This item as JSON

More from lore-glass

All 10 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Glass Buttonglass-buttonlore-glassComponentsFreeno deps
Glass Dialogglass-dialoglore-glassComponentsFree1 dep
Glass Dockglass-docklore-glassComponentsFree1 dep
Glass Inputglass-inputlore-glassComponentsFree1 dep
Glass Popoverglass-popoverlore-glassComponentsFree1 dep
Glass Sliderglass-sliderlore-glassComponentsFreeno deps
Glass Switchglass-switchlore-glassComponentsFreeno deps
Glass Tabsglass-tabslore-glassComponentsFree1 dep

Also from Kynth Studios

Built for the same person as BlockDex

SkillWorks

Claude Code skills and plugins, scored

skillworks.kynth.studio

RuleStack

AGENTS.md gallery and agent-config comparison

rulestack.kynth.studio

ToolDrift

What the AI coding tools changed last night

tooldrift.kynth.studio

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex