webgl-liquid-metal
它能做什么
创建一个网页,显示一个闪亮、流动的金属表面,像熔化的金属或铬面,颜色效果会随观察角度变化。全部在一个文件中完成。
适用场景
- ✓当你想要“液态金属”或“熔铬”质感时。
- ✓想做出“全息”或“彩虹光泽”效果时。
- ✓需要一个有反光、流动的表面时。
技能链接
https://github.com/nexu-io/open-design/blob/main/plugins/_official/examples/webgl-liquid-metal/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“创建一个带有闪亮液态金属效果的页面。”
每周 5 个新技能,1 分钟读完。
工作原理
它使用一种叫 WebGL 的技术直接在屏幕上绘制,模拟光线与金属表面的相互作用。它计算光泽和颜色,营造出熔融金属的视觉效果。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Liquid Metal Skill
Produce a single self-contained index.html that renders a real-time metallic surface full-screen — molten chrome with an iridescent sheen — with a clean typographic overlay on top.
Why this is a powered artifact
OpenDesign detects getContext('webgl2') and renders this file in powered preview — a cross-origin-isolated iframe with allow-same-origin. The full GPU pipeline is available; you do not need to work around the opaque sandbox.
Resource map
webgl-liquid-metal/
├── SKILL.md ← you're reading this
└── example.html ← a working domain-warped chrome shader (READ FIRST)
Workflow
Step 0 — Read the reference
Read example.html end to end. Note the shape: a domain-warped fbm height field; a surface normal reconstructed from that field's gradient (finite differences); metallic shading = diffuse chrome ramp + a sharp specular (pow(dot(n,h), 80)) + a fresnel term; and an iridescent cosine palette (0.5 + 0.5*cos(2π(x + phase))) driven by height and fresnel for the thin-film sheen.
Step 1 — Choose the surface
- Molten chrome (default): domain-warped fbm height, hard specular, cool grey base.
- Holographic foil: crank the iridescence, widen the palette phase spread, soften the specular.
- Oil slick: darker base, thinner high-frequency warp, stronger fresnel bands.
Step 2 — Build index.html
- One file, zero external requests. Fullscreen triangle + fragment shader.
- Reconstruct the normal from small height offsets (
e ≈ 0.0016); a sharp specular exponent (≥ 60) is what reads as "metal". - Keep the iridescence tasteful — tie it to fresnel/height so it appears at grazing angles, not everywhere.
- Compile shaders with error logging so a typo fails loudly, not silently black.
Step 3 — Overlay + brand
- Map the accent colors to the active DESIGN.md when one is present; otherwise a restrained metallic palette. The reference tints the hottest specular toward lime
#63fe13as the brand accent. - Headline ≤ 13ch plus one supporting line. Keep the metal as the hero.
Step 4 — Self-review (P0)
- Renders continuously at ~60fps; the FPS badge updates.
- Reads unmistakably as metal: a sharp, moving specular highlight.
- Iridescence is present but restrained (grazing angles), not a rainbow wash.
- Resizes crisply on window resize (no stretching / blur).
- Degrades to a message (not a blank page) if
webgl2is unavailable.
常见问题
什么是“域扭曲噪声场”?
这是一种生成复杂、不规则图案的方法,用来为金属表面增添纹理和动感。
什么是“虹彩薄膜光泽”?
指一种颜色会变化的光泽,就像肥皂泡或油膜表面的效果,它是由薄层结构造成的。
为什么是单个 index.html 文件?
这样便于分享和展示,因为它不依赖其他外部文件就能运行。
详情
作者的原始描述
A real-time liquid-metal shader — a domain-warped noise field shaded as molten chrome, with a sweeping specular highlight over an iridescent thin-film (cosine-palette) sheen. No textures. Rendered as a single self-contained `index.html`. Use when the brief asks for "liquid metal", "molten chrome", "iridescent", "holographic", "metallic", "thin-film", or a reflective flowing surface. OpenDesign ser
repo: nexu-io/open-design
热度
- GitHub 星标
- 101k
- 排名
- #1059
- 许可证
- Apache-2.0
- 更新时间
- 2026/10/15
评论
- …