MaterialSpringState
struct · ferroui-themes-material · v0.5.0
struct MaterialSpringState
A velocity-continuous spring for interactive controls whose target may change mid-flight.
Call Self::advance with frame time, then Self::retarget on an input change. Retargeting
preserves both the current position and its physical velocity, including when the target
reverses direction. No allocations or numerical integration are involved.
Members
new
fn new(spec: MaterialSpringSpec, value: f64) -> Self
current
fn current(self: &Self) -> MaterialSpringSample
target
fn target(self: &Self) -> f64
retarget
fn retarget(self: &mut Self, target: f64)
set_spec
fn set_spec(self: &mut Self, spec: MaterialSpringSpec)
Changes the motion scheme without discontinuously resetting the live state.
set_reduced_motion
fn set_reduced_motion(self: &mut Self, reduced_motion: bool)
advance
fn advance(self: &mut Self, seconds: f64) -> MaterialSpringSample
is_at_rest
fn is_at_rest(self: &Self, position_threshold: f64, velocity_threshold: f64) -> bool
finish
fn finish(self: &mut Self)
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedClassDefaultsErasedDestructorIntoEitherCastableFrom<ST, Uninit, Uninit>CastableFrom<ST, Initialized, Initialized>Read<Exclusive, BecauseExclusive>CloneCopyDebug
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.