PointBurstBuilder

Struct PointBurstBuilder 

Source
pub struct PointBurstBuilder { /* private fields */ }
Expand description

Simpler builder for particles bursting outward from a point.

let burst = PointBurstBuilder::new(320.0, 320.0)
    .velocity(100.0)
    .color(Color::ORANGE)
    .build();

Implementations§

Source§

impl PointBurstBuilder

Source

pub fn new(x: f64, y: f64) -> Self

Create a new point burst builder at the specified position.

Source

pub fn birth_rate(self, rate: f32) -> Self

Set the number of particles spawned per second.

Source

pub fn lifetime(self, seconds: f32) -> Self

Set how long each particle lives (in seconds).

Source

pub fn lifetime_range(self, range: f32) -> Self

Set random variation in lifetime.

Source

pub fn velocity(self, v: f64) -> Self

Set initial velocity (points per second).

Source

pub fn velocity_range(self, range: f64) -> Self

Set random variation in velocity.

Source

pub fn scale(self, s: f64) -> Self

Set the scale of particles.

Source

pub fn scale_range(self, range: f64) -> Self

Set random variation in scale.

Source

pub fn scale_speed(self, speed: f64) -> Self

Set rate of scale change per second.

Source

pub fn alpha_speed(self, speed: f32) -> Self

Set rate of alpha change per second (negative = fade out).

Source

pub fn color(self, color: impl Into<Color>) -> Self

Set particle color using a Color value.

§Example
.color(Color::CYAN)
.color(Color::rgb(1.0, 0.8, 0.2))
Source

pub fn color_rgb(self, r: f64, g: f64, b: f64) -> Self

Set particle color (RGB, 0.0-1.0).

Source

pub fn color_rgba(self, r: f64, g: f64, b: f64, a: f64) -> Self

Set particle color (RGBA, 0.0-1.0).

Source

pub fn image(self, img: ParticleImage) -> Self

Set the particle image. Defaults to soft_glow(64) if not set.

Source

pub fn render_mode(self, mode: RenderMode) -> Self

Set the render mode. Defaults to Additive.

Source

pub fn build(self) -> Retained<CAEmitterLayer>

Build the CAEmitterLayer configured for point burst.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,