Skip to main content

Interpolatable

Trait Interpolatable 

Source
pub trait Interpolatable: Clone {
    // Required method
    fn lerp(&self, other: &Self, t: f32) -> Self;
}
Expand description

Trait for types that can be linearly interpolated.

This is used by the animation system to interpolate between values. Most numeric types implement this automatically via the blanket impl.

Required Methods§

Source

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

Linear interpolation: self + (other - self) * t

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 Interpolatable for f32

Source§

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

Source§

impl Interpolatable for f64

Source§

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

Source§

impl<A: Interpolatable, B: Interpolatable, C: Interpolatable, D: Interpolatable> Interpolatable for (A, B, C, D)

Source§

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

Source§

impl<A: Interpolatable, B: Interpolatable, C: Interpolatable> Interpolatable for (A, B, C)

Source§

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

Source§

impl<A: Interpolatable, B: Interpolatable> Interpolatable for (A, B)

Source§

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

Source§

impl<T: Interpolatable + Copy, const N: usize> Interpolatable for [T; N]

Source§

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

Implementors§