FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    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.

    View source

    Members

    new

    fn new(spec: MaterialSpringSpec, value: f64) -> Self
    

    Source

    current

    fn current(self: &Self) -> MaterialSpringSample
    

    Source

    target

    fn target(self: &Self) -> f64
    

    Source

    retarget

    fn retarget(self: &mut Self, target: f64)
    

    Source

    set_spec

    fn set_spec(self: &mut Self, spec: MaterialSpringSpec)
    

    Changes the motion scheme without discontinuously resetting the live state.

    Source

    set_reduced_motion

    fn set_reduced_motion(self: &mut Self, reduced_motion: bool)
    

    Source

    advance

    fn advance(self: &mut Self, seconds: f64) -> MaterialSpringSample
    

    Source

    is_at_rest

    fn is_at_rest(self: &Self, position_threshold: f64, velocity_threshold: f64) -> bool
    

    Source

    finish

    fn finish(self: &mut Self)
    

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • ClassDefaults
    • ErasedDestructor
    • IntoEither
    • CastableFrom<ST, Uninit, Uninit>
    • CastableFrom<ST, Initialized, Initialized>
    • Read<Exclusive, BecauseExclusive>
    • Clone
    • Copy
    • Debug

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.