pub struct ScalarSpring {
pub smooth: f32,
pub undamp: f32,
pub goal: f32,
pub value: f32,
pub vel: f32,
pub time: u64,
pub enabled: bool,
}
Expand description
Critically damped spring modulator. Moves towards its set goal
with smooth
seconds
of delay, critically damping its arrival so it slows down and stops at the goal without
overshooting or oscillation.
If overshooting is desired, positive values of undamp
can be set to add artificial
overshoot/oscillations around the goal.
Fields§
§smooth: f32
Spring delay (smoothing), in seconds
undamp: f32
Amount of damping to remove (0..1)
goal: f32
Current target for the spring
value: f32
Current position of the spring (value)
vel: f32
Current velocity
time: u64
Accumulated microseconds
enabled: bool
Enabling toggle
Implementations§
Source§impl ScalarSpring
impl ScalarSpring
Trait Implementations§
Source§impl Modulator<f32> for ScalarSpring
impl Modulator<f32> for ScalarSpring
Source§fn elapsed_us(&self) -> u64
fn elapsed_us(&self) -> u64
Total accumulated microseconds for the modulator.
Source§fn set_enabled(&mut self, enabled: bool)
fn set_enabled(&mut self, enabled: bool)
Toggle enabling/disabling the modulator
Auto Trait Implementations§
impl Freeze for ScalarSpring
impl RefUnwindSafe for ScalarSpring
impl Send for ScalarSpring
impl Sync for ScalarSpring
impl Unpin for ScalarSpring
impl UnwindSafe for ScalarSpring
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