Liquid Glass for the web, rendered with WebGPU + WebGL

(About) N°01

liquidGL is a real-time liquid glass engine for the modern web. True refraction, chromatic aberration and fluid distortion, composited live on the GPU with WebGPU and WebGL.

One script.
Open-source.

liquidGL - by NaughtyDuk©
(Examples) N°03
Draggable Fluid
Frost Minimal Refraction
Audio Reactive Stacked Lenses
Chromatic Aberration Refraction
Interaction Fluid
Frost Specular
(Features) N°02

Refraction, with blur and light responses that feel natural, react like glass and are exceptionally performant.

Tuned for realism.

Tinted Glass 01 / 07

liquidGL is free to use

But it’s not free to build. We built this library so that everyone can use modern UI aesthetics to the web. If you can, please support us.

Give what you can One-time
liquidGL license artwork
(Public API) N°04

Browse liquidGL's powerful API that supports granular control, real-time property updates and more.

Built for production.

const lens = liquidGL({  target: '.liquidGL',  snapshot: 'body',  resolution: 2.0,  engine: 'auto',  zIndex: undefined,  content: undefined,  refraction: 0.01,  aberration: 0,  bevelDepth: 0.08,  bevelWidth: 0.15,  frost: 0,  shadow: true,  specular: true,  reveal: 'fade',  tilt: false,  tiltFactor: 5,  tiltEase: 400,  draggable: false,  interaction: 'none',  interactionStrength: 0.5,  interactionRadius: 0.35,  interactionViscosity: 0.65,  magnify: 1,  tint: null,  helper: false,  on: {    init: () => {}  }});lens.destroy();
01

target

CSS Selector

Selects which elements become liquid lenses. Accepts any valid CSS selector, so one call spins up a single hero pane or an entire grid.

Default.liquidGL Example#hero-lens
02

snapshot

CSS Selector

Chooses the root element captured for the background snapshot the lens refracts - defaults to the whole page.

Defaultbody RoleSnapshot root
03

resolution

Number

Scales the size of the captured background snapshot relative to the document, trading texture memory for sharpness.

Default2.0 Range0.1 - 3.0
04

engine

String

Forces a specific rendering backend, or lets liquidGL pick the best one available for the browser.

Defaultauto Optionswebgpu / webgl / webgl2
05

zIndex

Integer

Pins the lens canvas to an explicit stacking order when it needs to sit above or below specific page content.

Defaultundefined Range±2147483646
06

content

CSS Selector

Points the lens at a different element whose children are composited crisp and undistorted on top of the refracted glass, instead of the target's own content.

Defaultundefined RoleCrisp overlay source
07

refraction

Number

Controls how aggressively light bends through the lens - from a subtle sheen to a deep, glassy pull.

Default0.01 Range0 - 1
08

aberration

Number

Splits colour at the lens edge like real optics, dialled from clinical to cinematic.

Default0 Range0 - 1
09

bevelDepth

Number

Sets how deep the lens edge appears to cut into the glass, shaping its 3D profile.

Default0.08 Range0 - 1
10

bevelWidth

Number

Sets how wide the bevel band is around the lens edge, from a thin rim to a broad curve.

Default0.15 Range0 - 1
11

frost

Number

Diffuses the scene behind the glass while specular highlights keep the surface alive.

Default0 Range0 - 1
12

shadow

Boolean

Toggles the soft drop shadow cast by the lens onto the content beneath it.

Defaulttrue RoleDrop shadow
13

specular

Boolean

Toggles the live specular highlight that tracks light across the glass surface.

Defaulttrue RoleLive highlight
14

reveal

String

Controls how the lens appears on load - a soft fade-in, or an instant, un-animated reveal.

Defaultfade Optionsfade / none
15

tilt

Boolean

Lets the pane rotate in 3D as the cursor or touch point moves across it, easing back flat on hover-out.

Defaultfalse RolePointer tilt
16

tiltFactor

Number

Scales how strongly the lens reacts to cursor and touch position, in degrees of rotation.

Default5 RoleTilt sensitivity
17

tiltEase

Number (ms)

Sets how quickly the tilt response settles, in milliseconds.

Default400 RoleTilt settle time
18

draggable

Boolean

Lets users pick up any pane with mouse or touch and move it freely, staying wherever it's dropped.

Defaultfalse Eventsdragstart / drag / dragend
19

interaction

String

Turns on a fluid ripple that follows the pointer across the glass, displacing the surface as it moves.

Defaultnone Modesnone / fluid
20

interactionStrength

Number

Sets how far the surface displaces in response to pointer speed when the fluid interaction is active.

Default0.5 Range0 - 5
21

interactionRadius

Number

Sets the reach of the fluid displacement effect around the pointer, relative to the lens size.

Default0.35 Range0 - 5
22

interactionViscosity

Number

Sets how thick the glass feels when the fluid interaction moves - higher values follow and settle slower, like real liquid.

Default0.65 Range0 - 1
23

magnify

Number

Scales the refracted content under the lens independently of its on-screen size.

Default1 Range0.001 - 3.0
24

tint

Color

Infuses the glass with colour, composited through every layer beneath it.

Defaultnull Formatrgba / hex
25

helper

Boolean

Loads a separate dev GUI for live-tweaking every option in real time - requires liquidGL-helper.js to be imported.

Defaultfalse RoleDev tweak panel
26

on

Object

Hooks into the lens lifecycle - fire your own code when it initialises or when a drag starts, moves and ends.

Default{} Eventsinit / dragstart / drag / dragend
27

destroy

Method

Tears down a single lens - restoring its original styles, removing its listeners and freeing its GPU resources - without touching any other lens sharing the same canvas.

Returnsvoid Calllens.destroy()
Play