pub trait FloatDecayAnimationSpec {
// Required methods
fn abs_velocity_threshold(&self) -> f32;
fn get_value_from_nanos(
&self,
play_time_nanos: i64,
initial_value: f32,
initial_velocity: f32,
) -> f32;
fn get_velocity_from_nanos(
&self,
play_time_nanos: i64,
initial_value: f32,
initial_velocity: f32,
) -> f32;
fn get_duration_nanos(
&self,
initial_value: f32,
initial_velocity: f32,
) -> i64;
fn get_target_value(&self, initial_value: f32, initial_velocity: f32) -> f32;
}Expand description
Trait for decay animation specifications.
A decay animation has no fixed target - it starts with a velocity and decelerates to zero. The final position depends on the initial velocity.
Required Methods§
Sourcefn abs_velocity_threshold(&self) -> f32
fn abs_velocity_threshold(&self) -> f32
Velocity threshold below which animation is considered finished.
Sourcefn get_value_from_nanos(
&self,
play_time_nanos: i64,
initial_value: f32,
initial_velocity: f32,
) -> f32
fn get_value_from_nanos( &self, play_time_nanos: i64, initial_value: f32, initial_velocity: f32, ) -> f32
Get position at a given time.
Sourcefn get_velocity_from_nanos(
&self,
play_time_nanos: i64,
initial_value: f32,
initial_velocity: f32,
) -> f32
fn get_velocity_from_nanos( &self, play_time_nanos: i64, initial_value: f32, initial_velocity: f32, ) -> f32
Get velocity at a given time.
Sourcefn get_duration_nanos(&self, initial_value: f32, initial_velocity: f32) -> i64
fn get_duration_nanos(&self, initial_value: f32, initial_velocity: f32) -> i64
Get total animation duration in nanoseconds.
Sourcefn get_target_value(&self, initial_value: f32, initial_velocity: f32) -> f32
fn get_target_value(&self, initial_value: f32, initial_velocity: f32) -> f32
Get the target value (final position) of the animation.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".