Skip to main content

Lerp

Trait Lerp 

Source
pub trait Lerp: Sized {
    // Required method
    fn lerp(&self, to: &Self, t: f64) -> Self;
}
Expand description

Linear interpolation; t is already eased and may leave [0, 1] (e.g. with back easings).

Required Methods§

Source

fn lerp(&self, to: &Self, t: f64) -> Self

Value at t between self (0) and to (1); t may leave 0..=1.

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 String

Typewriter: keeps the common prefix, deletes the rest of self during the first part of the tween and types the rest of to afterwards. The time split is proportional to the number of characters.

Source§

fn lerp(&self, to: &Self, t: f64) -> Self

Source§

impl Lerp for f32

Source§

fn lerp(&self, to: &Self, t: f64) -> Self

Source§

impl Lerp for f64

Source§

fn lerp(&self, to: &Self, t: f64) -> Self

Source§

impl<T: Lerp + Clone> Lerp for Vec<T>

Element-wise when lengths match; otherwise snaps at the midpoint.

Source§

fn lerp(&self, to: &Self, t: f64) -> Self

Source§

impl<T> Lerp for Option<T>
where T: Clone + Lerp,

Source§

fn lerp(&self, to: &Self, t: f64) -> Self

None on either side snaps at the midpoint.

Implementors§

Source§

impl Lerp for BezPath

Source§

impl Lerp for Color

Interpolates in OKLab so that midpoints keep perceived lightness.

Source§

impl Lerp for Gradient

Same kind and stop count: points, offsets and colors interpolate. Otherwise the gradient switches at the midpoint.

Source§

impl Lerp for Point

Source§

impl Lerp for Transform

Source§

impl Lerp for Vec2