Expand description
Particle emitter builders.
Particles are small images spawned continuously from an emitter. Each particle has properties like velocity, lifetime, and color. The GPU handles rendering, so thousands of particles run smoothly.
ⓘ
use std::f64::consts::PI;
use core_animation::prelude::*;
let emitter = CAEmitterLayerBuilder::new()
.position(320.0, 320.0)
.shape(EmitterShape::Point)
.particle(|p| p
.birth_rate(100.0)
.lifetime(5.0)
.velocity(80.0)
.emission_range(PI * 2.0) // all directions
.color(Color::CYAN)
.image(ParticleImage::soft_glow(64))
)
.build();For simple point bursts, use PointBurstBuilder instead.
Structs§
- CAEmitter
Cell Builder - Builder for a particle type.
- CAEmitter
Layer Builder - Builder for a particle emitter layer.
- Point
Burst Builder - Simpler builder for particles bursting outward from a point.
Enums§
- Emitter
Mode - Mode determining where on the shape particles spawn.
- Emitter
Shape - Shape of the emitter - where particles spawn.
- Particle
Image - Pre-built particle images.
- Render
Mode - Render mode determining how particles are composited.