pub struct CAEmitterLayerBuilder { /* private fields */ }Expand description
Builder for a particle emitter layer.
ⓘ
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)
.color(Color::CYAN)
)
.build();Implementations§
Source§impl CAEmitterLayerBuilder
impl CAEmitterLayerBuilder
Sourcepub fn size(self, width: f64, height: f64) -> Self
pub fn size(self, width: f64, height: f64) -> Self
Set the emitter size (for Line, Rectangle, etc.).
Sourcepub fn shape(self, shape: EmitterShape) -> Self
pub fn shape(self, shape: EmitterShape) -> Self
Set the emitter shape.
Sourcepub fn mode(self, mode: EmitterMode) -> Self
pub fn mode(self, mode: EmitterMode) -> Self
Set the emitter mode.
Sourcepub fn render_mode(self, mode: RenderMode) -> Self
pub fn render_mode(self, mode: RenderMode) -> Self
Set the render mode.
Sourcepub fn birth_rate(self, rate: f32) -> Self
pub fn birth_rate(self, rate: f32) -> Self
Set the overall birth rate multiplier.
This multiplies the birth rate of all cells. Use 0.0 to pause emission, 1.0 for normal rate.
Sourcepub fn cell(self, cell: Retained<CAEmitterCell>) -> Self
pub fn cell(self, cell: Retained<CAEmitterCell>) -> Self
Add a pre-built cell directly.
Prefer using .particle() for most cases.
Sourcepub fn build(self) -> Retained<CAEmitterLayer> ⓘ
pub fn build(self) -> Retained<CAEmitterLayer> ⓘ
Build the CAEmitterLayer.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CAEmitterLayerBuilder
impl !RefUnwindSafe for CAEmitterLayerBuilder
impl !Send for CAEmitterLayerBuilder
impl !Sync for CAEmitterLayerBuilder
impl Unpin for CAEmitterLayerBuilder
impl !UnwindSafe for CAEmitterLayerBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more