Skip to content

Particles

particles(kind:, count:, ...) is a generative point-sprite field. Like metaballs it runs entirely in the viewer — the language has no loops or randomness, so the particles are generated from a seeded PRNG and their motion is driven by the frame time (deterministic, seamless).

It ships eight presets — stars, dust, snow, embers, magic_sparks, fireflies, smoke, pollen — each with its own motion, colour, size and glow. kind: cycle rotates through all eight over period; this example does exactly that across an 8-second loop. Use a single kind on its own with particles(kind: snow), and tune count, area, speed, size, color.

rendering…
runner "0.0.1";

use std.shapes.*;

scene particle_field(duration: Duration = 8s) -> Frame {
  let bg = rect(width: 1920px, height: 1080px, fill: #05070f);
  compose [bg, particles(kind: cycle, count: 400, period: 8s)]
}