Liquid Glass In The Browser Refraction With CSS & SVG - Chris Feijoo
summary
Recreates Apple’s Liquid Glass refraction in the browser using CSS and SVG, claiming real‑time refraction with simple math (Snell–Descartes law) and a displacement pipeline that maps Cartesian vectors into image channels (R = X, G = Y) by encoding −1→0, 0→128, +1→255. Implementation samples rays across an edge profile, normalizes by max displacement, feeds an SVG feDisplacementMap, and shows working demos (draggable refractive bubble, a switch and slider). A reagent library named refractive is available as pre‑alpha on npm via @hashintel/refractive; demos mostly work though a few drag bugs appeared.
AI-written summary · about
chapters (11)
- 0:00Introduction and setup
- 2:10History of glass in UI design
- 5:14Physics of refraction explained
- 7:23Creating depth with edge profiles
- 9:08Vector field and displacement maps
- 11:55SVG filter implementation
- 12:58Specular highlights and light vectors
- 13:18Live demo of liquid glass effect
- 14:00Practical UI components with refraction
- 15:46Demos and blog resources
- 16:06Announcing the refractive library
