pub struct CAEmitterCellBuilder { /* private fields */ }Expand description
Builder for a particle type.
Used via CAEmitterLayerBuilder::particle(|p| p.birth_rate(...)).
Implementations§
Source§impl CAEmitterCellBuilder
impl CAEmitterCellBuilder
Sourcepub fn birth_rate(self, rate: f32) -> Self
pub fn birth_rate(self, rate: f32) -> Self
Set the number of particles spawned per second.
Sourcepub fn lifetime_range(self, range: f32) -> Self
pub fn lifetime_range(self, range: f32) -> Self
Set random variation in lifetime (+/- seconds).
Sourcepub fn velocity_range(self, range: f64) -> Self
pub fn velocity_range(self, range: f64) -> Self
Set random variation in velocity.
Sourcepub fn emission_longitude(self, radians: f64) -> Self
pub fn emission_longitude(self, radians: f64) -> Self
Set the direction of emission (radians, 0 = right, PI/2 = up).
Sourcepub fn emission_toward(self, from: (f64, f64), target: (f64, f64)) -> Self
pub fn emission_toward(self, from: (f64, f64), target: (f64, f64)) -> Self
Set emission direction to point toward a target position.
The from parameter is the emitter position.
Sourcepub fn emission_range(self, radians: f64) -> Self
pub fn emission_range(self, radians: f64) -> Self
Set the spread of emission (radians).
Use PI * 2.0 for emission in all directions (360°).
Use PI / 6.0 for a 30° spread.
Sourcepub fn scale_range(self, range: f64) -> Self
pub fn scale_range(self, range: f64) -> Self
Set random variation in scale.
Sourcepub fn scale_speed(self, speed: f64) -> Self
pub fn scale_speed(self, speed: f64) -> Self
Set rate of scale change per second.
Sourcepub fn alpha_speed(self, speed: f32) -> Self
pub fn alpha_speed(self, speed: f32) -> Self
Set rate of alpha change per second (negative = fade out).
Sourcepub fn spin_range(self, range: f64) -> Self
pub fn spin_range(self, range: f64) -> Self
Set random variation in spin.
Sourcepub fn acceleration(self, x: f64, y: f64) -> Self
pub fn acceleration(self, x: f64, y: f64) -> Self
Set acceleration (points per second squared).
Use negative y for gravity effect.
Sourcepub fn color_rgba(self, r: f64, g: f64, b: f64, a: f64) -> Self
pub fn color_rgba(self, r: f64, g: f64, b: f64, a: f64) -> Self
Set particle color (RGBA, 0.0-1.0).
Sourcepub fn image(self, img: ParticleImage) -> Self
pub fn image(self, img: ParticleImage) -> Self
Set the particle image.
Sourcepub fn build(self) -> Retained<CAEmitterCell> ⓘ
pub fn build(self) -> Retained<CAEmitterCell> ⓘ
Build the CAEmitterCell.