Fire
Flames off a top edge with embers that are flung up, slow to a buoyant drift and cool from white to red; plasma hugging a border; or a little heat for a button.
Hot take
<Fx effect="fire" preset="Flames" />Features
- Domain-warped flames off a top edge, hottest at the base.
- Embers flung up, slowed by drag into a buoyant drift, cooling white to red.
- Plasma hugging a border, and a small heat preset for buttons.
Use it for
- A hot take or trending item.
- Error and 404 pages.
- A dramatic deploy button.
On this site
- 404A page that is gone has burned down to embers.
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="fire" />
</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 |
|---|---|---|
style Style | top, heat, border, embers | top |
low Low | color | 0x8a1405 |
mid Mid | color | 0xff5a14 |
hot Hot | color | 0xffc65a |
height Height | 4 to 160 | 54 |
scale Scale | 4 to 80 | 20 |
speed Speed | 0 to 5 | 1.5 |
intensity Intensity | 0 to 3 | 1 |
embers Embers | 0 to 40 | 16 |
emberRise Ember rise | 0 to 200 | 58 |
emberSize Ember size | 0.2 to 3 | 0.8 |
emberLife Ember life | 0.2 to 4 | 1.5 |
warp Warp | 0 to 3 | 1 |
sides Sides | 0 to 1 | 0.32 |
baseGlow Base glow | 0 to 2 | 0.5 |
swirl Swirl | 0 to 3 | 0 |
occlusion Occlusion | 0 to 1 | 0.25 |
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/emit.ts in runets, MIT licensed.