Skip to content
IndexRequest a UIAboutContact

Glass Refraction Lens

Move a piece of glass over a pattern and it bends the background, with distortion strength and shape controls.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI IMAGE OR VIDEO TOOL
Close-up product render of a clear glass lens resting on a colourful geometric pattern of stripes and circles, the pattern visibly bent and slightly magnified inside the lens with smooth wave-like distortion, a thin bright rim of light around the edge and a soft white highlight at the top left, a gentle shadow below, studio light, clean and tactile. Variants: a rounded rectangle glass pane and a droplet-shaped bubble. Negative: opaque blobs, noise artefacts, hard edges, text, logos. Reduced motion: static image.

About this pattern

Definition

Real glass and water bend light: what you see through them is shifted and sometimes magnified, which is refraction. In CSS, an SVG displacement filter can fake it by pushing pixels of the background according to a noise map, giving a believable liquid-glass distortion.

When to use it

  • feTurbulence makes a smooth noise map; feDisplacementMap shifts pixels using it.
  • The scale value sets how strong the bend is.
  • Clip the distorted copy to a lens shape; add a thin bright rim and a soft highlight.
  • A slight magnification makes it look like a thick lens.

What the controls do

  • Three shape buttons, a Distortion slider; move the pointer to move the lens.

Motion & timing

  • The lens follows the pointer directly.
  • Reduced motion: no easing is used.

Tips & variations

  • Heavy filters are expensive; keep the filtered area small.
  • Test in several browsers; filter support on backdrop layers varies, so this demo filters a copy of the background instead.

Code of this live preview

HTML
<svg width="0" height="0" aria-hidden="true" focusable="false"><defs><filter id="rf" x="-10%" y="-10%" width="120%" height="120%"><feTurbulence type="fractalNoise" baseFrequency="0.018" numOctaves="2" seed="4" result="n"/><feDisplacementMap id="dm" in="SourceGraphic" in2="n" scale="24" xChannelSelector="R" yChannelSelector="G"/></filter></defs></svg><div class="bx"><div class="pre" id="pre" role="group" aria-label="Shape"><button data-p="0" aria-pressed="true">Circle</button><button data-p="1" aria-pressed="false">Pane</button><button data-p="2" aria-pressed="false">Droplet</button></div><div class="sc" id="sc"><div class="bg" id="b0"></div><div class="lens" id="ln" data-s="0"><div class="in"><div class="bg" id="b1"></div></div></div></div><label class="rw">Distortion <b id="dv">24</b><input id="ds" type="range" min="0" max="60" value="24"></label></div>

Related patterns

Frosted Glass & Acrylic

↗
Frosted Glass & AcrylicSurfaces & Objects

Magnifier Glass Lens

↗
Magnifier Glass LensGlass & Tactile

Condensation Droplets

↗
Condensation DropletsGlass & Tactile