Trait anima_engine::math::Interpolate [] [src]

pub trait Interpolate {
    fn interpolate(&self, other: Self, ratio: f32) -> Self;
}

A trait to be implemented by structures that need to handle 2-way interpolation. (not necessarily linear)

Examples

struct Object {
    height: f32
}

impl Interpolate for Object {
    fn interpolate(&self, other: Object, ratio: f32) -> Object {
        Object {
            height: (1.0 - ratio) * self.height + ratio * other.height
        }
    }
}

Required Methods

fn interpolate(&self, other: Self, ratio: f32) -> Self

Implementors