Diorama

Made for a big screen.

This site is one 3D scene, built for a computer: a wide window and a mouse. Open dioramajs.dev on a desktop or a laptop to see it.This site is one 3D scene, built for a wide window. Make this one wider, or open dioramajs.dev on a larger screen.

GitHub

DioramaDocs

@dioramajs/text/water

Exports of @dioramajs/text/water.

View as Markdown
On this page
import { CALM, decay, default } from '@dioramajs/text/water'

Functions

decayPer-step factor that leaves waves `exp(-rate)` of their height after a second.
gridThe grid of the simulation over a domain of `width` by `height` px: cells across, down and the cell size.
iceMapThe ice over a domain of `width` by `height` texels with `em` texels to the em, rows top down, RGBA bytes: red the cracks, green the frost (thick at the edges, in patches and along the cracks), blue the cracks blurred, for the light they bend.
puddleThe puddle around the text in a `width` by `height` box: a signed distance to its shore in px, negative in the water, rows top down, `scale` texels per px. The shore wanders between SHORE ems past the glyphs and rounds off where it meets the box, so nothing marks the box.

Classes

PondThe drops waiting for the simulation and a bound on how high the waves still are, so frames stop once the water is calm.

Constants

CALMBelow this wave height (cells) the water counts as calm and the simulation is cleared.
defaultThe heading lies under water: a surface simulated on the GPU bends the letters and the page beneath, focuses light into dancing caustics on them and reflects the sky, with a tint that deepens the farther the light goes. The pointer drags ripples and clicks drop them; rain rings out on its own; ice stays still under frost and cracks until the pointer melts a clear patch.
SHOREEms the water reaches past the glyphs, at least and at most, along its wandering shore.
STEPSSimulation steps a second, at most per frame, and drops one step takes.
SWELLThe swell under every style: five waves from different directions whose crests focus light into the net of caustics. Their strength is the share of the focal distance their curvature reaches, so the net looks the same at any font size.

Interfaces

DropA drop on the water in cells, y up: its place, radius and height (negative digs a crater).
WaveOne wave of the swell: wavelength (em), direction (rad, box axes), focusing strength, phase.

Types