pub struct ColorOverLife {
pub birth_color: [f32; 4],
pub death_color: [f32; 4],
pub max_life: f32,
}Expand description
Lerps a particle’s color from birth_color to death_color over its life.
Fields§
§birth_color: [f32; 4]Color when the particle is born (life == max_life).
death_color: [f32; 4]Color when the particle is about to die (life → 0).
max_life: f32The initial (maximum) lifetime used to compute normalised age.
Implementations§
Source§impl ColorOverLife
impl ColorOverLife
Sourcepub fn new(birth_color: [f32; 4], death_color: [f32; 4], max_life: f32) -> Self
pub fn new(birth_color: [f32; 4], death_color: [f32; 4], max_life: f32) -> Self
Create a new color-over-life modifier.
Sourcepub fn apply(&self, particle: &mut GpuParticle)
pub fn apply(&self, particle: &mut GpuParticle)
Update the color of a single particle based on remaining life.
Sourcepub fn apply_all(&self, particles: &mut [GpuParticle])
pub fn apply_all(&self, particles: &mut [GpuParticle])
Update colors for all alive particles.
Trait Implementations§
Source§impl Clone for ColorOverLife
impl Clone for ColorOverLife
Source§fn clone(&self) -> ColorOverLife
fn clone(&self) -> ColorOverLife
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ColorOverLife
impl Debug for ColorOverLife
impl Copy for ColorOverLife
Auto Trait Implementations§
impl Freeze for ColorOverLife
impl RefUnwindSafe for ColorOverLife
impl Send for ColorOverLife
impl Sync for ColorOverLife
impl Unpin for ColorOverLife
impl UnsafeUnpin for ColorOverLife
impl UnwindSafe for ColorOverLife
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more