# apple-liquid-glass-webgl — full documentation Source: https://github.com/Oliverrr2424/webgl-apple-liquid-glass#readme Package: https://www.npmjs.com/package/apple-liquid-glass-webgl License: MIT # apple-liquid-glass-webgl [![npm](https://img.shields.io/npm/v/apple-liquid-glass-webgl?color=2f66e0)](https://www.npmjs.com/package/apple-liquid-glass-webgl) [![license](https://img.shields.io/npm/l/apple-liquid-glass-webgl?color=2f66e0)](LICENSE) [![dependencies](https://img.shields.io/badge/dependencies-none-2f66e0)](package.json) Apple-style liquid glass for the web, rendered with WebGL2. Point it at an element and it refracts what is actually behind that element on the page, while it scrolls, resizes and animates. CSS `backdrop-filter` can blur and tint what is behind an element; this bends it. The refraction runs in a WebGL2 shader, so it does not depend on `backdrop-filter: url(#filter)`, which only Chromium honours — Safari and Firefox get the same bent, dispersed, edge-captured glass, not a flat blur. The element keeps its DOM: your text stays real text, selectable and readable by a screen reader, because the glass is drawn behind its children.

Four liquid-glass surfaces over a liquid marble backdrop, then over the Earth with the background pre-blur ramped up behind them

Swiping between two iPhone Home screen pages, folders and widgets rendered as liquid glass Press effects: a selected capsule dragged along its track, a button held until it blooms, a toggle flipped
[Playground](https://oliverrr2424.github.io/webgl-apple-liquid-glass/) · [Docs and FAQ](https://oliverrr2424.github.io/webgl-apple-liquid-glass/docs/) · [中文文档](https://oliverrr2424.github.io/webgl-apple-liquid-glass/docs/zh/) · [Landing page example](examples/landing) ## Install ```bash npm install apple-liquid-glass-webgl ``` ## Quick start ```js import { LiquidGlass } from 'apple-liquid-glass-webgl'; new LiquidGlass('.navbar'); ``` That is the whole integration: - The element keeps its content, layout and events. The glass is drawn behind its children. - Shape and corner radius come from its CSS `border-radius`. - It follows the element through scrolling, resizing, CSS transitions and JS animation. - Without WebGL2 it falls back to `backdrop-filter`. The element gets `data-liquid-glass="webgl"` or `"fallback"` for styling. ## What is behind the glass Browsers do not let WebGL read page pixels, so the library repaints what is behind the glass itself. The default, `backdrop: 'auto'`, paints the page below the element in CSS paint order, `z-index` included: backgrounds (colors, images, gradients), borders, ``, `