#[repr(C)]pub struct SpringCurve {
pub stiffness: f32,
pub damping: f32,
pub mass: f32,
}Expand description
Mass-spring-damper parameters for AnimationInterpolationFunction::Spring.
Lives here rather than in azul-core because it is part of a #[repr(C)]
CSS enum that crosses the C ABI; azul-core re-exports it so the animation
engine can keep talking about Spring without reaching across layers.
Fields§
§stiffness: f32Pull toward the target. Higher = faster, more eager.
damping: f32Resistance. Higher = less overshoot; at critical damping, none.
mass: f32Inertia. Higher = more sluggish, more overshoot for a given stiffness.
Implementations§
Source§impl SpringCurve
impl SpringCurve
Sourcepub const SNAPPY: Self
pub const SNAPPY: Self
Fast with a slight overshoot; for small controls that should feel crisp.
Sourcepub const MAX_STEP_SECS: f32 = 0.05
pub const MAX_STEP_SECS: f32 = 0.05
Longest step handed to the integrator, in seconds (~3 frames at 60 Hz).
Sourcepub const EPSILON_VALUE: f32 = 0.06
pub const EPSILON_VALUE: f32 = 0.06
Distance below which a spring counts as arrived (~a sixteenth of a device px).
Sourcepub const EPSILON_VELOCITY: f32 = 0.06
pub const EPSILON_VELOCITY: f32 = 0.06
Speed below which a spring counts as stopped, in units/second.
Sourcepub fn damping_ratio(&self) -> f32
pub fn damping_ratio(&self) -> f32
The damping ratio: < 1 under-damped (overshoots), 1 critical, > 1 over-damped.
Trait Implementations§
Source§impl Clone for SpringCurve
impl Clone for SpringCurve
Source§fn clone(&self) -> SpringCurve
fn clone(&self) -> SpringCurve
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more