Shockwave

A ring of displaced light expanding from a point, with a little chromatic split on its front. A one-shot.

<Fx effect="shockwave" />

Features

  • A ring of displaced pixels with a chromatic split on its front.
  • Highlights only where there is content, so empty space gets no grey donut.

Use it for

  • Confirming an action.
  • Impact, unlocking, arrival.

Installation

  1. Get runets.
    git clone https://github.com/ziyam-khan/runets
  2. Copy these files into your project, keeping their folders.
  3. Install what they use.
    pnpm add react

Usage

import { Fx } from 'runets'

<div className="card"> {/* position: relative */}
  <Fx effect="shockwave" />
</div>

API

PropTypeWhat it does
effectstringThe effect’s id, as in the address of this page.
presetstringOne of the presets above; the first by default.
paramsParamsAny parameter from the table, over the preset.
place'under' | 'over'Under the parent’s content (fills, halos) or over it (sparkles, glass). Default under.
radiusnumberCorner radius in points; the parent’s own border radius by default.
backdropstring | PaintWhat glass and distortion read: an image URL, or a function that paints a canvas the size of the parent.
maskPaintAn alpha mask for mask glow and text sheen.
hotbooleanDrives heat: the layer lights in 60 ms and cools over half a second instead of cutting off.
triggernumberChange it to fire a one-shot now (ping, ripple, burst, shockwave, zap).
wakenumberChange it to redraw for a second when something the layer reads, such as its occluders, moves on its own.
shape(time, w, h) => RectThe effect’s shape inside the parent, per frame: a lens that drifts.

Parameters

NameRangeDefault
reach Reach20 to 400160
width Width2 to 4014
amount Amount0 to 309
chroma Chroma0 to 10.35
dur Duration0.2 to 30.9

Reads a backdrop: an image or a painted canvas given to the layer, refracted or sampled per pixel.

Accessibility

Source

The code is in src/fx/glsl/surface.ts in runets, MIT licensed.