particles — Luau Binding
require("particles"): define emitters, fire bursts, and let them spray pooled, seeded-random particles on the stage tick. The programmatic surface of the particles system. Every function is[antos].
Status: design. Not built yet.
local particles = require("particles")
| Call | Returns | Does |
|---|---|---|
particles.emitter(opts) |
em |
define an emitter — opts = { rate, lifetime, area, speed, spread, gravity, over_life = { alpha, scale, color } }. Draws from a pooled particle set and the seeded PRNG |
em:at(x, y) |
em |
position the emitter (or attach to a target) |
em:start() / em:stop() |
ok |
begin / end continuous emission |
em:burst(n) |
ok |
emit n particles at once (an explosion) |
particles.clear(em?) |
ok |
kill live particles (an emitter's, or all) |
local particles = require("particles")
local smoke = particles.emitter{ rate = 40, lifetime = 1.2, speed = 30, spread = 20,
gravity = -50, over_life = { alpha = 0, scale = 2 } }
smoke:at(chimney.x, chimney.y):start()
-- same seed -> identical smoke, every run