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

Glass class

Water on the glass: drops that rest and dry, heavy ones that slide down in fits and starts, leave a wet trail and beads, and swallow what they meet.

View as Markdown
import { Glass } from '@dioramajs/particles/drops'

. Deterministic for a seed; px, y down.

class Glass

Members

NameTypeDescription
constructor
constructor(seed: number, pool?: number): Glass
readonly dropsDrop[]

Default [].

laidnumber

Default 0.

readonly poolnumber

Default POOL.

timenumber

Default 0.

readonly trailsFloat32Array

Trail pieces: x0, y0, x1, y1, width, birth time.

Default ....

wetnumber

Last trail piece written, s.

Default Number.NEGATIVE_INFINITY.

readonly thawingboolean

True while a thaw spreads.

add
add(x: number, y: number, r: number, weather: Weather): Drop | undefined

A drop of radius r at x, y; merges with one it lands on.

radius
radius(scale: number, heavy?: number): number

A radius from the mix of a melt or a shower: mostly beads, some drops, a few heavy ones.

shower
shower(count: number, weather: Weather): void

A shower of count drops at once.

step
step(
  seconds: number,
  weather: Weather,
  rate?: number,
): 'moving' | 'drying' | 'still'

Advances by seconds with new rain at rate drops a second. Returns 'moving' while drops slide or appear, 'drying' while only drops at rest and trails dry, 'still' when the glass is bare.

thaw
thaw(x: number, y: number, count: number, duration: number): void

Starts a thaw from x, y that leaves count drops behind its front over duration.

Defined in packages/particles/src/drops.ts.