Skip to main content

Interpolate

Trait Interpolate 

Source
pub trait Interpolate: Copy {
    // Required methods
    fn lerp(self, other: Self, t: f32) -> Self;
    fn distance(self, other: Self) -> f32;
}
Expand description

A value an animation can move through.

t outside 0..1 is meaningful: overshoot curves and underdamped springs deliberately pass their target, so implementations extrapolate rather than clamp.

Required Methods§

Source

fn lerp(self, other: Self, t: f32) -> Self

Source

fn distance(self, other: Self) -> f32

How far apart two values are, in one number, so a retarget can rescale a velocity it is carrying into the new distance.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Interpolate for Hsla

Source§

fn lerp(self, other: Self, t: f32) -> Self

Interpolates hue the short way around the wheel, so a red-to-magenta transition does not sweep through the entire spectrum.

Source§

fn distance(self, other: Self) -> f32

Measured over the same short way around the wheel that lerp travels, so the distance is the distance actually covered.

Source§

impl Interpolate for Pixels

Source§

fn lerp(self, other: Self, t: f32) -> Self

Source§

fn distance(self, other: Self) -> f32

Source§

impl Interpolate for Rems

Source§

fn lerp(self, other: Self, t: f32) -> Self

Source§

fn distance(self, other: Self) -> f32

Source§

impl Interpolate for f32

Source§

fn lerp(self, other: Self, t: f32) -> Self

Source§

fn distance(self, other: Self) -> f32

Source§

impl<T: Interpolate + Clone + Debug + Default + PartialEq> Interpolate for Point<T>

Source§

fn lerp(self, other: Self, t: f32) -> Self

Source§

fn distance(self, other: Self) -> f32

Source§

impl<T: Interpolate + Clone + Debug + Default + PartialEq> Interpolate for Size<T>

Source§

fn lerp(self, other: Self, t: f32) -> Self

Source§

fn distance(self, other: Self) -> f32

Implementors§