Faster captures
snapdom's foreignObject pipeline does in ~80ms what html2canvas does in ~300ms.
// features
Real-time refraction, adjustable bevels, frosted blur, specular highlights, tilt. The library does the maths so the page can do the design.
Static, video, and animated content — all refracted live in WebGL.
Tune depth and width of the rim refraction to taste.
Optional blur radius for a privacy-pane diffusion. Zero keeps it crystal clear.
Animated light highlights that move with time. Off if you want flat.
Subtle 3D parallax on cursor movement. Tunable depth.
Zoom lens contents from 0.001× through 3×. Real lens, real maths.
A grounded shadow underneath. Cheap on the GPU.
Animate transform, border-radius, opacity at 60fps with GSAP.
Videos in the snapshot are detected and re-captured per frame.
Drop-in support for Lenis, Locomotive Scroll, and GSAP ScrollTrigger.
~50KB by default. html2canvas only loads if your page actually needs it.
on.init callbackHook the moment the first frame paints. Chain reveal animations from there.
// what's new
Captures used to be the slow part. Glassworks ships snapdom as the default backend with an html2canvas hybrid fallback. On a typical page, captures drop from ~300ms to ~80ms.
snapdom's foreignObject pipeline does in ~80ms what html2canvas does in ~300ms.
html2canvas only loads if your page needs it — when an absolute overlay is detected on the snapshot target.
Patched the upstream bug where multiple in-flow lenses collapsed the snapshot. Lenses stay perfectly aligned, even far down the page.
Same liquidGL({...}) call, same options, same behaviour. Existing code keeps working — just point the script tag at the new build.
Want the html2canvas-only pipeline? Pass engine: "html2canvas" or load liquidGL-legacy.js. Drift fix applied either way.
// quick start
Two scripts, one selector, a few options. That's it.
<!-- 1. snapdom: capture backend -->
<script src="https://cdn.jsdelivr.net/npm/@zumer/snapdom/dist/snapdom.js" defer></script>
<!-- 2. glassworks -->
<script src="/scripts/liquidGL.js" defer></script>
// initialise after DOMContentLoaded
const glass = liquidGL({
target: ".liquidGL",
refraction: 0.026,
bevelDepth: 0.119,
bevelWidth: 0.057,
specular: true,
shadow: true,
});
Full options, presets, and FAQ in the README →
// demos
Each demo is a self-contained page. View source if you want to copy the setup.
A sticky nav backed by a refracting lens. The classic app-bar pattern, refracting whatever scrolls past.
A frosted credit-card surface over a moving background. Perfect for fintech UIs.
Lens transforms animated with GSAP. Border-radius, scale, position — all live.
Many cards, one shared canvas. Built so you don't blow the WebGL context budget.
Circular morphs that reveal scenes as the lens transforms.
Every option, five copy-paste presets, and the FAQ. The reference doc.