Skip to main content

Interpolate

Trait Interpolate 

Source
pub trait Interpolate: Clone {
    // Required method
    fn interpolate(&self, target: &Self, progress: f64) -> Self;
}
Expand description

Values that can interpolate between endpoints. Progress may overshoot 0.0..=1.0. Implement this trait to sample custom values with Tween and Keyframes. Progress and geometry use double precision. f32 values retain their own arithmetic; colors extrapolate Oklab and clamp only alpha.

Required Methods§

Source

fn interpolate(&self, target: &Self, progress: f64) -> Self

Blends toward target with nominal progress zero at self and one at target.

Custom implementations should be deterministic and handle overshoot intentionally. Built-in floats/pairs extrapolate; bounds preserve signed extrapolated dimensions. Colors extrapolate Oklab and clamp alpha.

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 f32

Source§

fn interpolate(&self, target: &Self, progress: f64) -> Self

Source§

impl Interpolate for f64

Source§

fn interpolate(&self, target: &Self, progress: f64) -> Self

Source§

impl<First: Interpolate, Second: Interpolate> Interpolate for (First, Second)

Source§

fn interpolate(&self, target: &Self, progress: f64) -> Self

Source§

impl<Value: Interpolate, const COUNT: usize> Interpolate for [Value; COUNT]

Source§

fn interpolate(&self, target: &Self, progress: f64) -> Self

Implementors§