Rain

Three depths of slanted streaks that catch the light behind them, splashes on the wet ground, and drops sliding down the glass in surges, each a tiny fisheye showing the scene upside down.

<Fx effect="rain" />

Features

  • Three depths of slanted streaks that catch the light behind them.
  • Splashes on the ground line.
  • Drops sliding down the glass in surges, each a fisheye showing the scene upside down, leaving trails of beads.

Use it for

  • Night cities and noir.
  • Moody heroes.

On this site

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="rain" />
</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
intensity Intensity0 to 21
wind Wind0 to 20.5
speed Speed0 to 21
density Density0 to 21
tint Tintcolor0xbfe0ff
lens Drops on glass0 to 10.55
ground Ground line0.3 to 10.8

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/weather.ts in runets, MIT licensed.