Readable core
Warp strength builds toward the rim instead of distorting the whole slab, preserving content through the center.
A canvas compositor for filleted refraction, shared blur, subtle chromatic splitting, and a readable center — without putting a CSS backdrop-filter on the pill.
Interactive demo
Drag the pill over the type. The center stays readable while the refraction, blur, and chromatic split build toward the edge.
Why this approach
The compositor samples the real backdrop, blurs it once, then shapes the optical behavior with a rounded-rectangle signed distance field.
Warp strength builds toward the rim instead of distorting the whole slab, preserving content through the center.
The sampled backdrop is blurred once and reused by the glass pass, keeping the effect visually coherent.
Chromatic separation and faint top/bottom hairlines appear at grazing angles instead of washing the entire surface.
Use it
Install directly from GitHub today, mount it onto a container, and provide the scene you want the glass to refract.
npm install github:XposeMarket/liquid-glass
import { mountLiquidGlass, DEFAULT_SPEC } from "@xposemarket/liquid-glass";
mountLiquidGlass(document.querySelector("#stage"), {
spec: DEFAULT_SPEC,
drawScene(ctx, w, h) {
ctx.fillStyle = "#1a1e26";
ctx.fillRect(0, 0, w, h);
ctx.fillStyle = "#f0f4f8";
ctx.font = "600 42px -apple-system, sans-serif";
ctx.fillText("drag the glass over this line", w * 0.07, h * 0.3);
}
});
Under the hood
The default compositor stays intentionally direct: sample, blur, shape, warp, split, shade.