Spring
struct · ferroui-base · v0.5.0
struct Spring
Determines how an animation is used based on spring formula.
Members
newwith_valuesparsemassset_massstiffnessset_stiffnessdampingset_dampinginitial_velocityset_initial_velocityget_spring_progress
new
fn new() -> Self
Creates a spring with all parameters zero.
with_values
fn with_values(mass: f64, stiffness: f64, damping: f64, initial_velocity: f64) -> Self
Creates a spring with the given parameters.
parse
fn parse(value: &str) -> Result<Spring, FormatError>
Parses a spring from four numbers: mass, stiffness, damping and initial velocity.
mass
fn mass(self: &Self) -> f64
The spring mass.
set_mass
fn set_mass(self: &Self, value: f64)
stiffness
fn stiffness(self: &Self) -> f64
The spring stiffness.
set_stiffness
fn set_stiffness(self: &Self, value: f64)
damping
fn damping(self: &Self) -> f64
The spring damping.
set_damping
fn set_damping(self: &Self, value: f64)
initial_velocity
fn initial_velocity(self: &Self) -> f64
The spring initial velocity.
set_initial_velocity
fn set_initial_velocity(self: &Self, value: f64)
get_spring_progress
fn get_spring_progress(self: &Self, linear_progress: f64) -> f64
Calculates the spring progress from a linear progress.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeAnyValueClassDefaultsBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyErasedDestructorIntoEitherPartialEqDefaultFromStr
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.