Skip to main content

Lerp

Trait Lerp 

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

Linear interpolation between two values of the same kind, t in 0.0..=1.0. The one primitive every interpolated quantity shares — implemented here for the scalar and color bindings, and by bevy-react’s transition engine for its own channel types (hence public).

Required Methods§

Source

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

self + (other - self) * t, component-wise where applicable.

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 Lerp for [f32; 4]

Source§

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

Source§

impl Lerp for f32

Source§

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

Implementors§

Source§

impl Lerp for Length

Interpolate two lengths of the same unit; mixed units or auto can’t be interpolated, so it snaps to the target.