Expand description
Particle lifecycle management.
This module provides ergonomic tools for configuring particle lifecycles, including aging, death, visual effects, and respawning via emitters.
§Hidden Lifecycle Fields
Every particle automatically has these fields (injected by the derive macro):
| Field | Type | Description |
|---|---|---|
age | f32 | Time since spawn/respawn (seconds) |
alive | u32 | 0 = dead (skip simulation), 1 = alive |
scale | f32 | Visual size multiplier (1.0 = normal) |
These are accessible in custom WGSL rules via p.age, p.alive, p.scale.
§Quick Start
ⓘ
Simulation::<Spark>::new()
.with_lifecycle(|l| {
l.lifetime(2.0)
.fade_out()
.emitter(Emitter::Point {
position: Vec3::ZERO,
rate: 500.0,
speed: 1.0,
});
})
.with_rule(Rule::Gravity(9.8))
.run();§Lifecycle Presets
Common particle system patterns available as one-liners:
ⓘ
.with_lifecycle(Lifecycle::fire(Vec3::ZERO, 800.0))
.with_lifecycle(Lifecycle::fountain(Vec3::new(0.0, -0.5, 0.0), 1000.0))
.with_lifecycle(Lifecycle::explosion(Vec3::ZERO, 500))Structs§
- Lifecycle
- Lifecycle configuration builder.