# Meniscus Source: https://meniscus.site/ · Updated 2026-10-02 > Meniscus is a liquid glass design system for AI assistants, as copy-paste prompts and a hosted MCP (Model Context Protocol) server: a design language with tested numbers, 41 component and 14 effect specs, build code for Figma, web, SwiftUI, Flutter and React Native, and verified reference renders. Ask an AI for liquid glass and you get a blurred card with a white border. Meniscus gives it the rules, the numbers and the code, as a prompt you copy into Claude, ChatGPT, Codex or Cursor, or as an MCP server you connect once, so the glass bends the backdrop at every edge, on web, SwiftUI, Flutter, React Native and Figma. ## Same request, with and without Meniscus Request: "Build a weather app home screen as a web page: a full-bleed landscape drawn procedurally behind everything (a dusk sky, layered mountains and a lake that reflects them; no external images), the city name and current temperature, an hourly forecast strip and a 10-day forecast list on liquid glass cards, and a floating liquid glass tab bar. Put everything in one self-contained index.html in this folder (inline CSS and JS, no build step, no external requests), designed for a 390×844 phone viewport." **Claude Code alone** (1 min 52 s) — Milky frost with a uniform white border on every card: glassmorphism. The landscape disappears behind the cards, and the forecast rows read through the tab bar. [Screenshot](https://meniscus.site/proof/without.webp "Weather app built without Meniscus: San Francisco, 68°, milky frosted forecast cards with uniform white borders over a dusk lake, a frosted tab bar.") · [open the page](https://meniscus.site/proof/without) **Claude Code + Meniscus (free)** (9 min 30 s) — Clear glass that bends the mountains and lake at every edge, so the landscape stays part of the screen. The selected tab is a lens and search sits in its own, as on iOS. [Screenshot](https://meniscus.site/proof/with.webp "Weather app built with Meniscus: Crescent Lake, 68°, clear glass forecast cards over mountains and a lake, a floating tab bar with the selected tab as a lens and search in its own round lens.") · [open the page](https://meniscus.site/proof/with) - The same request, word for word, in fresh headless Claude Code sessions, each in an empty folder: Claude Sonnet 5. - The only difference: the Meniscus server on the free plan, and “Use the meniscus tools.” at the end of the request. - Two runs per side; we show one of each. The second run without Meniscus looked alike; the second with it used emoji tab icons and drew its own status bar. - Without Meniscus the agent took under two minutes; with it, nine and a half, most of it reading the brief and the web recipe. - Nothing edited. Screenshots taken in Chrome at 390 × 844; the phones above run the pages themselves. ## What your agent gets - **A design language with numbers.** Bezel, displacement, blur, fills, rims and edge lines for every material, tuned to the current generation — plus the anti-patterns to reject. - **41 components, 14 effects.** Tab bars to sheets, refraction to liquid metal: anatomy, states, rules and the numbers for each. - **Recipes for five media.** Figma, web, SwiftUI, Flutter and React Native — each with what that platform can and cannot do. - **Verified references.** 163 renders filed by what they show, cropped to the glass, each with notes on what to look for. ## Platforms - **Figma & design tools:** Glass effect settings, a manual layer stack for tools without one, image-generation prompts. - **Web:** SVG displacement refraction, a WebGL shader, a React component and a frost fallback. - **SwiftUI:** glassEffect, containers and morphing, system bars, iOS 27 additions. - **Flutter:** An Impeller refraction shader with its widget, verified on Android and iOS. - **React Native:** A runnable Expo starter with native iOS glass and honest fallbacks. ## Two ways to use it **Copy a prompt (no install).** Open any component, effect or screen in the gallery (https://meniscus.site/gallery), pick your stack and your assistant, and copy one text that carries the rules, the numbers, the glass code and the checks. Paste it into Claude, ChatGPT, Codex or Cursor. Components and effects are free without an account; screens and the app builder are Pro. **Connect your AI (MCP).** Your assistant fetches the right spec every time and checks its own work: 1. **Add the server** to your assistant — one command or one line of config. 2. **Sign in** in the browser window it opens. Free to start. 3. **Ask for a screen** in your stack. Your agent pulls the brief, specs and images it needs. ```bash claude mcp add --transport http meniscus https://meniscus.site/mcp ``` Then ask: "Build a SwiftUI smart-home dashboard with a floating glass tab bar, room cards and a thermostat slider. Use the meniscus tools." ## Pricing - **Free** — $0 forever. Real liquid glass on every platform. Prompts for every component and effect, no sign-in; Recipes for web, SwiftUI, Flutter, React Native and Figma; Connect your AI: 50 tool calls a day; Pro free for your first 14 days. - **Pro** — $79 per year (or $9 a month). Whole screens and apps, ready to build. Everything in Free; 22 screen templates and the app prompt; React kit and React Native starter downloads; The full reference library; 2,000 tool calls a day. - **Team** — $199 per year. Pro for five people, managed by one owner. Everything in Pro; 5 seats, given by e-mail from your account; One invoice. - **Lifetime** — $399 once. Pro for one account, no renewals. Everything in Pro; All future updates; No renewals, ever. - **14-day money-back guarantee.** Not right for you? Ask within 14 days of your first payment and get all of it back. - **Cancel any time.** From Invoices and billing on your account page; you keep access until the period you paid for ends. - **Checkout by Lemon Squeezy.** The merchant of record handles payment, tax and invoices. We never see your card. ## Questions, bugs, refunds One address for all of it: support@meniscus.site. Refunds within 14 days of a first payment need no reason. Found something wrong in a spec or a recipe? Say so. Fixes land on the changelog, like the Chrome filter gap a test build turned up on 27 September. Recent updates: Twelve new screens, seven components, four effects (2026-10-21); Copy a prompt: liquid glass without installing anything (2026-10-21); Seven tools, made for coding agents (2026-10-21). All of them: https://meniscus.site/changelog ## Frequently asked ### Do I need to install anything? No. Copy a prompt from any component, effect or screen and paste it into Claude, ChatGPT, Codex or Cursor. Connecting Meniscus to your AI is optional: then it fetches the right spec on its own and checks its work. ### Is this Apple's Liquid Glass? No. Meniscus is an independent design system that teaches the look on every platform, including web, Flutter and React Native, where Apple ships nothing. It follows Apple's current release, iOS 27. ### What is free? Every component and effect prompt, without signing in, and connecting your AI with 50 tool calls a day. Pro adds the 22 screen templates, the app prompt, the React kit and the full reference library; new accounts get Pro free for 14 days. ### Can I use what it produces in client work? Yes. What your assistant builds with Meniscus is yours to ship, commercial or not. You may not resell the specs, images or starter themselves. ### What happens when Apple changes the material again? Prompts and the server update the day we ship the change. Apple shipped iOS 27 on 14 September 2026; Meniscus moved to its numbers 12 days later. Every change is on the changelog. --- # What is liquid glass? The rules vs glassmorphism Source: https://meniscus.site/liquid-glass · Updated 2026-10-02 > Liquid glass is a UI material that behaves like thick, rounded glass: along its edge it bends and magnifies whatever is behind it, a thin highlight traces its rim from one light direction, and the text and icons on it stay flat and sharp. Apple introduced it with iOS 26 and refined it in iOS 27; the look itself can be built on any platform. Glassmorphism blurs the backdrop. Liquid glass bends it. ## Liquid glass vs glassmorphism | Trait | Liquid glass | Glassmorphism | |---|---|---| | Backdrop | Bent and magnified inside a band along the edge (the bezel); calm in the centre | Blurred evenly; nothing bends | | Edge | About 1 px specular rim, brightest towards the light, with a dark edge line outside it | A uniform 1 px white border | | Fill | Light, taking its colour from what is behind | White at fixed opacity, often greyed | | Content on it | Flat and sharp; children never get their own glass | Often more glass cards inside glass cards | | Where it is used | Controls and overlays that float over content | Anything, including content cards | ## The five non-negotiables A surface is liquid glass only if all five hold. If one is missing it is ordinary glassmorphism. 1. **The backdrop bends at the edge.** Inside a band along the silhouette (the *bezel*) the scene behind is displaced and magnified, as if seen through thick rounded glass; the centre stays nearly undistorted. Blur alone is not liquid glass. Test: put straight lines (a grid, a horizon, text) behind it — they must visibly curve inside the bezel. 2. **A thin specular rim traces the silhouette.** About 1 px, brightest facing the key light (top-left), a dimmer counter-light on the opposite side (bottom-right), faint on the flanks. 3. **There is something to bend.** Glass floats over a detailed, colourful backdrop (photo, wallpaper with edges, content scrolling underneath). On a flat solid colour it can only show its rim. 4. **Content on glass is flat.** Labels, icons and child controls sit above the optics, are never refracted, and are drawn at full contrast. Children of a glass body do not get their own glass (no lens on a lens). 5. **Shapes are continuous.** Capsules, circles and squircles (continuous corners); nested radii are concentric. ## Materials | Material | Looks like | Use for | Profile | Blur | Fill (light / dark) | |---|---|---|---|---|---| | **Lens** (clear) | Thick clear glass, strong bend, almost no haze | Small controls: buttons, icon buttons, chips, avatars, slider thumbs, tab/segment indicators, floating action buttons over media | convex (round) or bevel (capsule) | 0.5–1 px | white 4–8 % / black 10–18 % | | **Regular** (default) | Clear glass with light haze; bends at the edge, calm centre | Bars and chrome: tab bar, toolbar, menubar, navigation bar, inputs, popovers, menus, cards | bevel | 2–6 px | white 12–18 % / black 26–34 % | | **Frost** | Milky pane, edge bend still visible, backdrop reduced to colour | Text-heavy or large surfaces: dialogs, sheets, sidebars, notifications, long menus | bevel | 10–20 px | white 24–34 % / black 36–46 % | | **Tint** | Regular glass carrying a colour | Selected/prominent states, "glass prominent" buttons, accent and danger variants | bevel | 1–4 px | accent at 25–40 % | | **Rim** (stylised) | Flat interior, bending only in a thin edge band, crisp outline | Decorative outlines, dense lists of small tiles, OTP slots | rim | 0.5–2 px | white 6–10 % / black 18–25 % | | **Flat** | No optics, only fill + hairline | Children inside another glass body, disabled states, reduced-transparency fallback | flat | 0 | vibrant fill 8–12 % | ## What changed in iOS 27 Apple's iOS 27, iPadOS 27 and macOS 27 release (September 2026) changed the material. Work made to the first generation's numbers now looks a version behind: - Stronger diffusion over busy content: regular and frost glass sit at the top of their blur range over text, photos and feeds. - A darker look at the edge: a 1 px dark edge line now runs just outside a brighter specular rim. - A clear-to-tinted setting lets the viewer make all glass clearer or more opaque; designs must hold at both ends. - Sidebars on desktop and tablet run edge to edge instead of floating as an inset card. - Desktop windows use continuous corners of about 20 px (26 px on macOS 26). ## Anti-patterns | Anti-pattern | Why it fails | Fix | |---|---|---| | Blur + white opacity + 1 px white border ("glassmorphism card") | no refraction, reads as frosted cardboard | add bezel refraction and a directional rim | | Glass cards inside glass cards | lens on lens, muddy, double rims | children flat; one glass body per stack | | Glass over a flat or softly blurred gradient | nothing to bend, material invisible | detailed backdrop or content underneath | | Uniform rim of equal brightness all around | no light direction | key light top-left, counter bottom-right | | Heavy colour tint or grey desaturation of the backdrop | kills the "takes colour from behind" quality | light fill, saturation boost | | Warped or refracted text/icons | content must stay legible | refract only the backdrop layer | | Rainbow/chromatic fill over the whole surface | dispersion belongs to the silhouette | ≤ 1–2 px fringe at the edge, if any | | Sharp-cornered rectangles, mismatched radii | glass is a moulded material | capsules, squircles, concentric radii | | Overlapping glass siblings (stacked toasts, menu on its trigger) | lens on lens | ≥ 8 px gap or intentional morph | | Glass on every element of a page | no hierarchy | glass for chrome and overlays only | | Liquid metal on bars, panels or several controls | an opaque mirror hides the backdrop and flattens the hierarchy | one metal accent per view (icon, logo, hero rim, selected ring); the rest stays glass | | Border beams on several elements, or a rotating conic beam on a wide capsule | noise without hierarchy; an angle-driven beam crawls mid-edge and races, stretched, round the caps | one beamed element per view, driven by distance along the outline | | Glass controls on opaque demo tiles or a fixed full-page background | glass looks like grey plastic | detailed backdrop directly under each body | | Glass host with its own fill (native button face, filled component frame) | the optic refracts that flat fill: uniform grey/white pill | host and containing frames paint nothing; fill only on the optic layer | | Mirrored/doubled lines inside a lens edge | displacement past the profile's limit, or an edge profile that stands vertical at the silhouette | displacement ≤ 0.5 × bezel (bevel), 0.67 × radius (convex), 0.17 × bezel (rim); bevel or convex profile (§4) | | Neon glows, dark inner shadows, painted bevel/emboss shading | skeuomorphic, not glass | specular rim + soft ambient shadow only; the bevel profile is a refraction, not a painted shade | | Desktop menubar/dock patterns dropped on mobile | wrong ergonomics | floating tab bar + bottom toolbar/sheets | ## Review checklist - [ ] Straight lines behind each glass body curve inside its bezel; the centre is calm. Where you set the blur yourself, judge it in one shot with the blur down to about 0.5 px (the shipped blur can hide thin lines); on frost it shows as a shift at the rim. - [ ] Every body has a ~1 px rim, brighter top-left than bottom-right, with a faint dark edge line outside it. - [ ] The backdrop has detail directly under every glass body (no opaque tile/section fill in between, no single fixed background for a long page). - [ ] No mirrored or doubled lines inside lens edges (fold check). - [ ] No glass body is a uniform flat pill: its host element / component frame paints no fill of its own. - [ ] Text and icons are sharp, undistorted, and meet contrast on the worst part of the backdrop. - [ ] No glass inside glass except the moving indicator (a tab or segment pill, a slider thumb, a switch knob); separate bodies are ≥ 8 px apart. - [ ] Materials fit the size: small = lens, bars = regular, text-heavy/large = frost. - [ ] Capsules and squircles; radii concentric. - [ ] One solid accent per group; modal overlays dim the world. - [ ] Press/drag change thickness or scale, not only opacity; reduced motion and reduced transparency handled. - [ ] The screen holds at both ends of the clear-to-tinted setting (clear with a dim layer over bright content, tinted with contrast from the fill). Where the platform does not expose the setting (web, Flutter), check it with the fills halved and doubled. ## Vocabulary - **Bezel:** edge band that bends - **Displacement:** backdrop shift at the outer edge - **Profile:** shape of the bend across the bezel (bevel, convex, rim, flat) - **Lens / Regular / Frost / Tint / Rim / Flat:** materials - **Key light / counter-light:** light directions of the specular layer - **Edge line:** dark hairline outside the rim - **Dim layer:** darkening behind modals or clear glass - **Clear-to-tinted setting:** the viewer's control over how much fill all glass carries - **Morph:** liquid merging of nearby glass bodies - **Concentric radius:** inner radius = outer − inset - **Scroll edge effect:** fade of content where it passes under a bar - **Dispersion:** chromatic fringe at the silhouette - **Caustics:** focused light patterns cast through glass or water - **Liquid metal:** opaque chrome accent whose reflections flow as bands - **Border beam:** short arc of light travelling along the rim at constant speed. ## Frequently asked ### Is liquid glass the same as glassmorphism? No. Glassmorphism is a blurred, white-tinted card with a uniform border. Liquid glass refracts: the backdrop visibly bends inside a band along the edge, a directional specular rim traces the silhouette, and content on the glass stays flat. Without the bend it is glassmorphism. ### Can you make liquid glass with CSS? Yes, in Chromium browsers: an SVG displacement map applied through backdrop-filter bends the backdrop at the edge. Safari and Firefox do not apply SVG filters in backdrop-filter, so they get a frosted fallback; a WebGL shader is the other way to refract on the web. ### Does liquid glass work in Flutter and React Native? Flutter can refract with an Impeller fragment shader on Android and iOS. React Native can use native iOS glass through Expo and needs honest fallbacks elsewhere. Meniscus has a recipe for each, with what the platform cannot do. ### What changed in iOS 27? Glass diffuses more over busy content, a dark edge line sits outside a brighter rim, viewers get a clear-to-tinted slider for all glass, and sidebars run edge to edge. Designs made to iOS 26 numbers look a generation behind. ### How do I get an AI assistant to design real liquid glass? Give it the rules and numbers instead of the word. Meniscus is an MCP server that hands Claude Code, Codex, Cursor, VS Code and other assistants the design language, component specs, platform recipes and reference images, with a checklist to verify the result. Specs for every component: https://meniscus.site/components · effects: https://meniscus.site/effects --- # Liquid glass in CSS: SVG refraction that works (2026) Source: https://meniscus.site/liquid-glass/css · Updated 2026-10-02 Blur with a white border is glassmorphism. Liquid glass bends the backdrop at its edge, and on the web that takes an SVG displacement map applied through `backdrop-filter: url()`. Chromium browsers render it; Safari and Firefox fall back to frost, so ship both. Below is the whole web recipe the Meniscus MCP server hands to coding agents: the displacement map in framework-free TypeScript, the markup and CSS, a React component, the rules that make or break it, the frost fallback and a WebGL shader for hero visuals. Ask your assistant (with Meniscus connected): "Build a liquid glass navigation bar and pricing cards for this web page, with the frost fallback for Safari. Use the meniscus tools." **In short:** Tier A — an SVG displacement map applied through `backdrop-filter: url()` — with the CSS frost fallback; the WebGL shader for hero and effect visuals. **Limits:** the tier A bend renders only in Chromium browsers; Safari and Firefox get tier B frost with no bend, so screenshot both. The WebGL tier bends only a backdrop it can sample (an image, video or drawn scene), not the live DOM. ### Tiers | Tier | Where | What you get | |------|-------|--------------| | **A. SVG displacement backdrop** | Chromium browsers (Chrome, Edge, Arc, Opera, Brave; also headless Chrome for screenshots) | real bezel refraction of the live page | | **B. CSS frost fallback** | Safari, Firefox, and when A is disabled | blur + saturation + fill + rim; no bending | | **C. WebGL / canvas shader** | all browsers, when the backdrop is known (an image, video or a scene you draw) | refraction, dispersion, frost noise, caustics, iridescence, morph | Ship A with B as the automatic fallback for UI chrome. Use C for hero visuals and effect panels. Never ship B alone and call it liquid glass. ### A1. Displacement map (framework-free TypeScript) ```ts export type Profile = "bevel" | "convex" | "rim" | "flat"; // Backdrop shift across the bezel, s = 0 at the outer edge .. 1 at its inner end, edge = 1. Paraxial refraction // (IOR 1.5) through a rounded edge follows the surface slope; a finite slope at the silhouette spreads the bend over the // whole bezel. bevel: edge 1 − (1 − s)³ → shift (1 − s)². convex: a dome over a circle (bezel = radius), the whole // face magnifies. rim: the bevel in the outer 35 % only. const BEND: Record number> = { bevel: (s) => (1 - s) ** 2, convex: (s) => ((1 - s) * (2 - s)) / 2, rim: (s) => (s < 0.35 ? (1 - s / 0.35) ** 2 : 0), flat: () => 0, }; // Fold limit: displacement × steepest slope must stay under the bezel (bevel 0.5 × bezel, convex 0.67, rim 0.17). const SLOPE: Record = { bevel: 2, convex: 1.5, rim: 2 / 0.35, flat: 0 }; export const maxDisplacement = (bezel: number, profile: Profile) => (SLOPE[profile] ? bezel / SLOPE[profile] : 0); // Corner shape: "round" is CSS border-radius; "squircle" is CSS `corner-shape: squircle`, a superellipse with exponent 4 // inside the same corner box (measured in Chrome: on a 200 px square the edge sits 119 px out along the diagonal, // where a circle reaches 100). The map and the element must use the same one, so the bend follows the visible edge. export type Corner = "round" | "squircle"; export const squircleCorners = typeof CSS !== "undefined" && CSS.supports?.("corner-shape", "squircle") === true; function sdShape(x: number, y: number, w: number, h: number, r: number, corner: Corner) { const qx = Math.abs(x - w / 2) - (w / 2 - r), qy = Math.abs(y - h / 2) - (h / 2 - r); if (corner === "squircle" && r > 0 && qx > 0 && qy > 0) return r * (((qx / r) ** 4 + (qy / r) ** 4) ** 0.25 - 1); return Math.hypot(Math.max(qx, 0), Math.max(qy, 0)) + Math.min(Math.max(qx, qy), 0) - r; } const maps = new Map(); export function displacementMap(w: number, h: number, radius: number, bezel: number, profile: Profile, corner: Corner = "round"): string { const key = `${w}x${h}:${radius}:${bezel}:${profile}:${corner}`; const hit = maps.get(key); if (hit) return hit; const canvas = document.createElement("canvas"); canvas.width = w; canvas.height = h; const ctx = canvas.getContext("2d")!, img = ctx.createImageData(w, h), d = img.data; const bend = BEND[profile], r = Math.min(radius, w / 2, h / 2); for (let y = 0; y < h; y++) for (let x = 0; x < w; x++) { const px = x + 0.5, py = y + 0.5, depth = -sdShape(px, py, w, h, r, corner); let dx = 0, dy = 0; if (depth > 0 && depth < bezel) { const nx = sdShape(px + 0.5, py, w, h, r, corner) - sdShape(px - 0.5, py, w, h, r, corner); const ny = sdShape(px, py + 0.5, w, h, r, corner) - sdShape(px, py - 0.5, w, h, r, corner); const len = Math.hypot(nx, ny) || 1, m = bend(depth / bezel); dx = (-nx / len) * m; dy = (-ny / len) * m; // inward: the rim shows backdrop from further inside } const i = (y * w + x) * 4; d[i] = 128 + dx * 127; d[i + 1] = 128 + dy * 127; d[i + 2] = 128; d[i + 3] = 255; } ctx.putImageData(img, 0, 0); const url = canvas.toDataURL(); maps.set(key, url); return url; } // SVG filter markup for one element size. displacement = max shift in px at the outer edge. // Mount it inside an (defs.insertAdjacentHTML("beforeend", markup)) so it parses as SVG; see A4 rule 2b. // The bezel is capped at the corner radius (deeper, the corner creases on its diagonal) and the displacement at the // profile's fold limit. export function glassFilterSvg(id: string, o: { w: number; h: number; radius: number; bezel: number; profile: Profile; displacement: number; blur: number; saturate?: number; corner?: Corner }): string { const bezel = Math.min(o.bezel, o.radius, o.w / 2, o.h / 2); const displacement = Math.min(o.displacement, maxDisplacement(bezel, o.profile)); const map = displacementMap(o.w, o.h, o.radius, bezel, o.profile, o.corner ?? "round"); return ` `; } // Chromium is the only engine that renders SVG filters inside backdrop-filter. Keep the userAgentData test: headless // Chrome reports "HeadlessChrome/…", which the regex alone misses, so screenshot QA would only see the fallback. export const supportsSvgBackdrop = typeof navigator !== "undefined" && ("userAgentData" in navigator || /\bChrome\/\d+/.test(navigator.userAgent)) && !/Firefox|FxiOS|CriOS|EdgiOS/.test(navigator.userAgent); ``` ### A2. Markup and CSS One glass body = a positioned element with four children: the optic layer (backdrop filter + fill), the glow, the rim, and the content. Keeping the optics on a child keeps content out of the filter. The children are ``s, so the same markup is valid inside a ` ``` ```css /* The scroll-edge band behind a floating tab bar (design language §8.6): blur and dim at the bar, fading upward. --bar-top = the bar's top edge measured from the bottom of the screen. */ .scroll-edge { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1; pointer-events: none; height: calc(var(--bar-top, 92px) + 16px); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); background: linear-gradient(to top, var(--scroll-edge-dim) 60%, transparent); -webkit-mask-image: linear-gradient(to top, #000 60%, transparent); mask-image: linear-gradient(to top, #000 60%, transparent); } .dock { position: fixed; left: 20px; right: 20px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 2; display: flex; gap: 12px; height: 60px; } .tab-bar { flex: 1; } .tab-bar > .glass__content { display: grid; grid-template-columns: repeat(4, 1fr); height: 100%; padding: 0 4px; } .tab-bar__pill { position: absolute; top: 4px; left: 4px; height: 52px; width: calc((100% - 8px) / 4); transition: translate .38s cubic-bezier(.3, 1.3, .5, 1), transform .32s cubic-bezier(.3, 1.45, .5, 1); } .tab { all: unset; position: relative; display: grid; place-items: center; align-content: center; gap: 2px; font-size: 11px; font-weight: 600; cursor: pointer; } .tab[aria-selected="true"] { color: var(--glass-accent-ink); } .tab:focus-visible { outline: 2px solid var(--glass-accent-ink); outline-offset: -4px; border-radius: 22px; } .search-lens { width: 60px; height: 60px; display: grid; place-items: center; cursor: pointer; } @media (prefers-reduced-motion: reduce) { .tab-bar__pill { transition: none; } } ``` ```js mountGlass(document.querySelector(".tab-bar"), { radius: 30, bezel: 22, displacement: 8.8, blur: 3 }); const pill = document.querySelector(".tab-bar__pill"); const pillGlass = mountGlass(pill, { radius: 26, bezel: 26, displacement: 10.4, blur: 1 }); mountGlass(document.querySelector(".search-lens"), { radius: 30, bezel: 30, displacement: 15, blur: 1, profile: "convex", interactive: true }); const tabs = [...document.querySelectorAll(".tab")]; tabs.forEach((tab, i) => { // The tabs sit above the pill, so they press it. tab.addEventListener("pointerdown", () => pillGlass.press(true)); for (const type of ["pointerup", "pointerleave", "pointercancel"]) tab.addEventListener(type, () => pillGlass.press(false)); tab.addEventListener("click", () => { tabs.forEach((t) => t.setAttribute("aria-selected", String(t === tab))); pill.style.translate = `${i * 100}% 0`; }); }); ``` ### A4. Rules that make or break the web version 1. `color-interpolation-filters="sRGB"` on the filter. Without it the neutral value 128 is converted to linear light and the whole backdrop slides sideways. 2. `filterUnits="userSpaceOnUse"`, `x=0 y=0 width/height` = the element's **integer** px size, the same size on `feImage`. Regenerate the map when the size changes (ResizeObserver) and cache maps by size. 2b. **Mount the filter as SVG.** Insert the markup into an `` element (`defs.insertAdjacentHTML`, or the ``'s `innerHTML`). Parsed through an HTML `
` or `DOMParser` with `text/html`, it becomes an HTML element named `filter`: Chrome then drops the whole `backdrop-filter` without an error — no blur, no bend, the glass turns fully clear. Check `document.getElementById(id) instanceof SVGFilterElement`. 3. Order **displacement → blur → saturate**. `feDisplacementMap` samples nearest-neighbour; blurring after it removes the jaggies. Minimum blur 0.5 px, and 1 px on convex lenses: they magnify their whole face (up to 4× at the rim), and below 1 px the magnified backdrop shows 2–3 px stair steps. Blurring before the bend does not remove them. 4. `scale` on `feDisplacementMap` = 2 × displacement (it shifts by `scale × (channel − 0.5)`). 4b. **Profile and share, not bigger numbers.** Use the BEND curves above with displacement 0.4 × bezel (bevel) or 0.5 × radius (convex); `glassFilterSvg` holds it to the fold limit. An edge that stands vertical at the silhouette (Snell's law through a squircle or quarter-circle surface) packs nearly all of the bend into the outer 1–2 px, so small values show nothing and large ones flip into mirrored rings: the glass reads as blur-only either way. Above an 80 px bezel the 8-bit map quantises; keep those bodies at ≤ 0.4 × bezel or use tier C. 5. Encode the inward direction: `R = 128 + 127·dx`, `G = 128 + 127·dy`, alpha 255. 6. Map corner radius = CSS `border-radius`, and map corner shape = CSS `corner-shape` (round, or squircle where the browser draws it); `backdrop-filter` is clipped to the element's rounded shape. 6b. **The glass host paints nothing.** Whatever the host element (or any wrapper between it and the page) paints is what the optic refracts. `