datumhue.particles.emitter(scene: Scene, options: particles.EmitterOptions) -> EmitterCreate a particle emitter inside scene: its particles are quads that face the camera. Emission starts immediately.
-- Speeds are units per second; gravity is units per second squared.
local sparks = datumhue.particles.emitter(scene, {
rate = 60,
lifetime = 1.5,
shape = { kind = "cone", radius = 0.2, angle = 0.4 },
velocity = { min = vec3(0, 3, 0), max = vec3(0, 5, 0) },
gravity = vec3(0, -4, 0),
size = { start = 0.2, stop = 0 },
color = { start = color("#dbbc7f"), stop = color("#e67e80") },
})options particles.EmitterOptions options 13 keys
| Key | Type | Default | Description |
|---|---|---|---|
| rate | number | 10 | Particles spawned per second while emitting. |
| seed | integer | 0 | Spawn-stream seed; the same configuration and seed reproduce the same pattern, and distinct seeds keep identically configured emitters from animating in lockstep. |
| max_particles | integer | 1000 | Live-particle cap, 1..100000; emission pauses at the cap. |
| lifetime | number | 2 | Seconds each particle lives. |
| shape | particles.Shape | particles spawn at the emitter's position | Where particles spawn relative to the emitter. |
| velocity | particles.VelocityRange | particles spawn at rest | Initial velocity, sampled per axis between min and max. |
| gravity | Vec3 | datumhue.math.vec3(0, 0, 0) | Constant acceleration applied every second. |
| size | particles.SizeOverLife | an edge length of 0.1 for the whole life | Particle size over its life. |
| color | particles.ColorOverLife | white, fading to transparent | Particle color over its life. |
| texture | Image | the quads are flat color | Image drawn on each quad. |
| blend | "alpha" | "add" | "alpha" | Alpha blending or additive glow. |
| space | "world" | "local" | "world" | Reference frame for spawned particles. |
| pos | Vec3 | datumhue.math.vec3(0, 0, 0) | Emitter position in the scene. |