pub enum AnimationPattern {
Pulse {
min_intensity: f32,
max_intensity: f32,
frequency: f32,
},
Flicker {
min_intensity: f32,
max_intensity: f32,
smoothness: f32,
seed: u32,
},
Strobe {
on_intensity: f32,
off_intensity: f32,
frequency: f32,
duty_cycle: f32,
},
Fade {
from_intensity: f32,
to_intensity: f32,
duration: f32,
},
MathDriven {
a: f32,
b: f32,
c: f32,
d: f32,
e: f32,
f: f32,
g: f32,
},
ColorCycle {
colors: Vec<Color>,
cycle_duration: f32,
smooth: bool,
},
Heartbeat {
base_intensity: f32,
peak_intensity: f32,
beat_duration: f32,
pause_duration: f32,
},
}Expand description
Describes an animated light pattern.
Variants§
Pulse
Smooth sinusoidal pulse between min and max intensity.
Flicker
Random flicker with configurable smoothness.
Fields
Strobe
On/off strobe at a fixed frequency.
Fade
Linear fade from one intensity to another over a duration, then hold.
MathDriven
Intensity driven by a mathematical function of time.
Fields
ColorCycle
Cycle through a list of colors over time.
Heartbeat
Heartbeat pattern: two quick pulses then a pause.
Implementations§
Source§impl AnimationPattern
impl AnimationPattern
Sourcepub fn evaluate_intensity(&self, time: f32) -> f32
pub fn evaluate_intensity(&self, time: f32) -> f32
Evaluate intensity at the given elapsed time.
Sourcepub fn evaluate_color(&self, time: f32) -> Option<Color>
pub fn evaluate_color(&self, time: f32) -> Option<Color>
Evaluate color at the given time (only meaningful for ColorCycle).
Trait Implementations§
Source§impl Clone for AnimationPattern
impl Clone for AnimationPattern
Source§fn clone(&self) -> AnimationPattern
fn clone(&self) -> AnimationPattern
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AnimationPattern
impl RefUnwindSafe for AnimationPattern
impl Send for AnimationPattern
impl Sync for AnimationPattern
impl Unpin for AnimationPattern
impl UnsafeUnpin for AnimationPattern
impl UnwindSafe for AnimationPattern
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.