Liquid metal
A polished conductor in a photo studio: a domed slab whose surface flows and pools, Fresnel to white at grazing angles, a little thin-film colour where it bends hardest.
<Fx effect="liquid-metal" preset="Chrome" />Features
- A domed slab or a tube border reflecting a photo studio.
- Flowing, pooling surface; Fresnel to white at grazing angles.
- Chrome, gold, rose gold and gunmetal presets.
Use it for
- Awards and accepted badges.
- Premium keys and tags.
On this site
- Research: the accepted badgeGold for what came through peer review.
Installation
- Get runets.
git clone https://github.com/ziyam-khan/runets - Copy these files into your project, keeping their folders.
- Install what they use.
pnpm add react
Usage
import { Fx } from 'runets'
<div className="card"> {/* position: relative */}
<Fx effect="liquid-metal" />
</div>API
| Prop | Type | What it does |
|---|---|---|
effect | string | The effect’s id, as in the address of this page. |
preset | string | One of the presets above; the first by default. |
params | Params | Any parameter from the table, over the preset. |
place | 'under' | 'over' | Under the parent’s content (fills, halos) or over it (sparkles, glass). Default under. |
radius | number | Corner radius in points; the parent’s own border radius by default. |
backdrop | string | Paint | What glass and distortion read: an image URL, or a function that paints a canvas the size of the parent. |
mask | Paint | An alpha mask for mask glow and text sheen. |
hot | boolean | Drives heat: the layer lights in 60 ms and cools over half a second instead of cutting off. |
trigger | number | Change it to fire a one-shot now (ping, ripple, burst, shockwave, zap). |
wake | number | Change it to redraw for a second when something the layer reads, such as its occluders, moves on its own. |
shape | (time, w, h) => Rect | The effect’s shape inside the parent, per frame: a lens that drifts. |
Parameters
| Name | Range | Default |
|---|---|---|
tint Tint | color | 0xe9ecf0 |
light Light | color | 0xffffff |
flow Flow | 0 to 1.5 | 0.6 |
scale Scale | 16 to 480 | 100 |
speed Speed | 0 to 2 | 0.35 |
bevel Bevel | 0 to 48 | 14 |
dome Dome | 0 to 1 | 0.55 |
angle Angle | -3.141592653589793 to 3.141592653589793 | -0.12 |
iridescence Iridescence | 0 to 1 | 0.08 |
contrast Contrast | 0.5 to 2 | 1 |
anchor Anchor | world, element | world |
border Border | 0 to 24 | 0 |
intensity Intensity | 0 to 1 | 1 |
Accessibility
- The canvas is aria-hidden and never takes the pointer; the parent keeps its semantics and focus.
- Under prefers-reduced-motion every loop settles on one calm pose; one-shots fade in place instead of travelling.
- Off screen, in a hidden tab or once settled, the layer draws nothing.
- data-motion="off" on the root element is a pause switch for the whole page: every layer rests on that calm pose until it is removed.
Source
The code is in src/fx/glsl/surface.ts in runets, MIT licensed.