vidmake v0.2.1
Download

Docs/LayersPage 22 / 45

Particles

The deterministic particles emitter — rate and burst, lifetime, speed, direction and spread, gravity and drag, size, colors, shapes, spin and seed — with sparks, snow and confetti examples.

View .md Ask Claude Ask ChatGPT

A particles layer emits small circles, squares or stars that fly, fall and fade. It is fully deterministic: every particle's path is a pure function of time and the seed, so any frame can be rendered on its own, a storyboard shows exactly what the render will, and the same project always gives the same video.

json
{ "id": "sparks", "type": "particles", "y": "86%", "width": 60,  "emitter": { "rate": 140, "lifetime": "1.8s", "speed": 720, "spread": 36, "gravity": 640,               "size": 13, "endSize": 3, "colors": ["#efebe2", "#f05a4e", "#f05a4eaa"] } }
00:00.0 · f 000
A fountain of sparks: a narrow cone upward, gravity pulls them back downDownload
particles-sparks.jsonjson
{  "compositions": [{    "id": "sparks", "description": "A fountain of sparks: a narrow cone upward, gravity pulls them back down",    "width": 1280, "height": 720, "fps": 30, "duration": "4s", "background": "#131210",    "layers": [      { "id": "sparks", "type": "particles", "y": "86%", "width": 60, "glow": { "radius": 10, "strength": 0.8 },        "emitter": { "rate": 140, "lifetime": "1.8s", "speed": 720, "speedRandom": 0.5, "angle": 0, "spread": 36,                     "gravity": 640, "size": 13, "endSize": 3, "colors": ["#efebe2", "#f05a4e", "#f05a4eaa"], "seed": 7 } },      { "id": "base", "type": "ellipse", "y": "86%", "width": 90, "height": 18, "fill": "#efebe2", "opacity": 0.9,        "glow": { "radius": 24, "color": "#f05a4e" } }    ]  }]}

#The emitter box

The layer's box is the area particles are born in, at random positions spread evenly across it. By default it is a single point (1×1) at the layer's x/y; give it a width for a line of emitters (a fountain base, the top edge of the frame for snow) and a height too for an area.

Particles are drawn in the layer's own coordinates. Moving, rotating or scaling the layer therefore moves every particle already in flight with it (the whole cloud rides along) rather than leaving a trail. A rotated layer also rotates the emission direction.

#Emitter fields

All emitter fields are plain values, set once for the layer.

fielddefaultnotes
rate20Particles per second, emitted steadily while the layer is on screen.
burst0Extra particles emitted all at once at the layer's start.
lifetime"2s"How long each particle lives (a time).
speed150Initial speed in px per second.
speedRandom0.30..1: how much slower than speed each particle may randomly be.
angle0Direction in degrees: 0 up, 90 right, 180 down, 270 left.
spread360Width of the emission cone in degrees, centered on angle. 360 is every direction.
gravity0Downward acceleration in px/s². Negative values pull up (smoke, bubbles).
drag0Air resistance: velocity decays by e^(−drag × age). 1–3 makes things float and settle.
size8Diameter in px at birth.
endSizesizeDiameter at the end of life; particles grow or shrink linearly between the two.
sizeRandom0.30..1: how much smaller each particle may randomly be.
colorslayer fillPlain colors; each particle picks one at random.
shapecirclecircle, square or star.
spin0Maximum rotation speed in degrees per second; each particle spins at a random speed and direction up to it. Visible on squares and stars.
fadetrueFade each particle out linearly over its lifetime.
seed1Change it for a different random pattern with the same settings.

Without colors every particle uses the layer's fill, which can be a gradient (it spans the emitter box). Effects on the layer, like glow, blur or blendMode: "add", apply to the whole cloud at once: the sparks above use glow for their bloom.

#Rate or burst

rate is a steady stream (fountains, snow, smoke, ambient dust). burst is an explosion at the layer's start (confetti, a firework, a success state). Use "rate": 0 with a burst so nothing follows the explosion, and start the particle layer exactly when the thing it celebrates appears:

00:00.0 · f 000
A confetti burst: burst emits everything at once, rate 0 adds nothing afterDownload
particles-confetti.jsonjson
{  "compositions": [{    "id": "confetti", "description": "A confetti burst: burst emits everything at once, rate 0 adds nothing after",    "width": 1280, "height": 720, "fps": 30, "duration": "3s", "background": "#f4f1ea",    "layers": [      { "id": "badge", "type": "star", "sides": 12, "innerRadius": 0.82, "y": "52%", "width": 260, "fill": "#c92a26",        "rotation": "=t * 20", "enter": "pop" },      { "id": "check", "type": "line", "y": "52%", "width": 104, "height": 76, "points": [[0, 42], [34, 76], [104, 0]],        "stroke": "#f4f1ea", "strokeWidth": 14,        "drawEnd": { "from": 0, "to": 1, "start": "0.25s", "duration": "0.35s", "ease": "easeOutCubic" } },      { "id": "confetti", "type": "particles", "y": "52%", "start": "0.15s",        "emitter": { "burst": 140, "rate": 0, "lifetime": "2.8s", "speed": 900, "speedRandom": 0.7, "spread": 360,                     "gravity": 260, "drag": 2.2, "size": 14, "sizeRandom": 0.5, "shape": "square", "spin": 540,                     "colors": ["#161412", "#c92a26", "#1f5fb0", "#d8d1c1"], "seed": 11 } }    ]  }]}

A burst only happens at the layer's start. For several bursts, use several particle layers (or repeat one with a delay and different positions).

#Snow, and starting mid-flow

A steady emitter starts empty: at its first frame no particle has been born yet. For an effect that should already be in full swing when the video starts (snow, rain, stars), give the layer a negative start of about one lifetime. The layer then begins before the composition, and frame 0 already shows a full sky:

00:00.0 · f 000
Snow: a full-width emitter above the frame, slow speed, drag and gentle spinDownload
particles-snow.jsonjson
{  "fonts": [{ "family": "Schibsted Grotesk", "path": "fonts/SchibstedGrotesk.ttf" }],  "compositions": [{    "id": "snow", "description": "Snow: a full-width emitter above the frame, slow speed, drag and gentle spin",    "width": 1280, "height": 720, "fps": 30, "duration": "6s",    "background": { "type": "linear", "angle": 180, "stops": ["#131210", "#1d1b18"] },    "layers": [      { "id": "snow", "type": "particles", "anchor": "top-left", "x": -40, "y": -80, "width": 1360, "height": 60, "start": "-8s",        "lint": { "ignore": ["offCanvas"] },        "emitter": { "rate": 60, "lifetime": "9s", "speed": 110, "speedRandom": 0.5, "angle": 180, "spread": 30, "size": 7, "sizeRandom": 0.7, "colors": ["#efebe2", "#efebe2aa", "#8f8a7f"],                     "fade": false, "seed": 3 } },      { "id": "title", "type": "text", "text": "First snow", "font": "Schibsted Grotesk", "fontWeight": 860, "fontSize": 124, "letterSpacing": -5.5,        "fill": "#efebe2", "enter": "fade" }    ]  }]}

The snow layer is a wide, flat box just above the frame ("y": -80, "height": 60) emitting straight down ("angle": 180) with a narrow spread, so flakes drift slightly sideways as they fall. Since its box is off-canvas, it sets "lint": { "ignore": ["offCanvas"] } to tell validate that this is intended.

#Recipes

effectemitter settings
sparks / fountainnarrow spread (30–45) upward, high speed, gravity about equal to speed, small endSize
confettiburst 100–200, rate: 0, spread: 360, drag 1.5–2.5, gentle gravity, shape: "square", spin
snowwide box above the frame, angle: 180, slow speed, long lifetime, fade: false, negative start
smoke / steamangle: 0, low speed, negative gravity, endSize several times size, blur on the layer
dust / bokehlarge box over the frame, speed 10–30, spread: 360, long lifetime, blur and low opacity
fireworkburst 80–150, rate: 0, spread: 360, speed 300–500, light gravity, drag about 1, glow on the layer

#Determinism and performance

  • Particle i is born at time i ÷ rate and its position, color, size and spin come from a hash of seed and i. Nothing accumulates between frames, so rendering frame 300 does not require frames 0–299, and --concurrency renders identical output.
  • Two layers with the same settings and the same seed are identical; change seed for variety.
  • Cost grows with the number of particles alive at once (rate × lifetime + burst). A few hundred is cheap; tens of thousands slow the render down.

For agents

Particles are random-looking but repeatable, so you can tune them by looking: render vidmake storyboard project.json -o sb.png --at 0.5s,1s,1.5s,2s after each change to speed, gravity or spread and compare. inspect reports only the emitter box, not individual particles.