liquid-glass-js
Add Apple Liquid Glass-style buttons and containers to a web page with liquid-glass-js, a plain JavaScript and WebGL library with real-time refraction, blur and nested glass. Use when the user wants a glassmorphism or liquid glass button, pill, circle or panel with a refraction effect, a glass UI that samples the page behind it, or help tuning edge, rim, blur and tint of a glass effect. Not for a plain CSS backdrop-filter blur.
- License 许可
- MIT
- 所属仓库
- siddu1004/SFP
- 最近更新
- 2026-11-09
- Stars
- ★ 5
- Forks
- 0
01 前言 Front Matter
- name
- liquid-glass-js
- description
- Add Apple Liquid Glass-style buttons and containers to a web page with liquid-glass-js, a plain JavaScript and WebGL library with real-time refraction, blur and nested glass. Use when the user wants a glassmorphism or liquid glass button, pill, circle or panel with a refraction effect, a glass UI that samples the page behind it, or help tuning edge, rim, blur and tint of a glass effect. Not for a plain CSS backdrop-filter blur.
02 资源文件 5
- 脚本reference/button.js24.4 KB
- 脚本reference/container.js25.3 KB
- 其他reference/glass.css1.0 KB
- 参考文档reference/readme.md10.1 KB
- 其他reference/styles.css705 B
03 SKILL.md 正文
liquid-glass-js
liquid-glass-js draws glass buttons and containers with WebGL shaders that refract and blur the page behind them. It has no build step and no npm package: the library is two source files, container.js and button.js, plus two small stylesheets. They are bundled in reference/ with the project's README, so use them from there.
Use it
- Copy
reference/container.js,reference/button.js,reference/glass.cssandreference/styles.cssinto the user's project (keepcontainer.jsbeforebutton.js, sinceButtonextendsContainer). - Load
html2canvasbefore them. The library uses it to capture the page for the refraction. - Create glass with the classes, as
reference/readme.mdshows:
const button = new Button({ text: 'Save', size: 28, type: 'pill', tintOpacity: 0.3, onClick: () => {} })
document.body.appendChild(button.element)
const container = new Container({ borderRadius: 24, type: 'pill' })
container.addChild(button) // nested glass samples the parent
document.body.appendChild(container.element)
Shapes are 'rounded', 'circle' and 'pill'. The tuning parameters (edge, rim and base intensity, blur radius, tint) and their ranges are in the README's table.
Things to check
- It needs WebGL 2 and a local server (WebGL and canvas capture do not work from a
file://page):npx serve .. - The glass shows whatever is behind it, so put it over an image or a gradient. On a flat colour there is nothing to refract.
- It samples the page with
html2canvas, so cross-origin images need CORS headers or they will not appear in the effect. - For a React app, create the instances in an effect after mount and add
button.elementto a ref, since the library works on DOM nodes. - Read
reference/container.jsbefore changing behaviour: the shader and the uniforms are in it.
04 同仓库更多 Skills
scientific-schematics
Generates scientific diagram drafts using Nano Banana 2 AI with smart iterative refinement. Uses Gemini 3.7 Flash for quality review. Refines when the review requests improvement, with at most two generations. Specialized in neural network architectures, system diagrams, flowcharts, biological pathways, and complex scientific visualizations.
polyhaven-texture-apply
Apply realistic PBR textures from PolyHaven to any Blender object. Supports metals, wood, concrete, fabric, and more. Trigger when asked to texture an object, apply a material from PolyHaven, make something look like metal/wood/marble, or change object surface.
polyhaven-studio-setup
Set up a professional product photography studio in Blender using PolyHaven HDRIs and PBR ground materials. Trigger when asked to create a studio setup, add HDRI lighting, set up product photography, or create a showroom scene.
polyhaven-scene-builder
Build complete product scenes using PolyHaven assets — HDRI environment, textured ground/pedestal, and optional props from the 3D model library. Trigger when asked to build a product scene, create a showcase setup, add a pedestal, or compose a product shot.
polyhaven-material-swap
Cycle through multiple PolyHaven materials on a product and render each variant. Great for showing color/finish options. Trigger when asked to show material variants, swap textures, create color options, show finish comparisons, or render product in different materials.
polyhaven-hdri-showcase
Render the same product across multiple HDRI environments and output a comparison grid. Trigger when asked to compare lighting setups, test different environments, show product in multiple settings, or create an HDRI comparison.