Derive Macro vert_macros::Lerp

source ·
#[derive(Lerp)]
Expand description

Derives the Lerp trait for a struct where each field implements Lerp. For example the Struct:

struct Color{
    r: f32,
    g: f32,
    b: f32,
}

Will get a lerp implementation that is:

impl Lerp for Color{
    fn lerp(&self, other: &Self, factor: f32) -> Self {
        Color {
            r: self.r.lerp(&other.r, factor),
            g: self.g.lerp(&other.g, factor),
            b: self.b.lerp(&other.b, factor),
        }
    }
}

Don’t use this Derive Macro if the fields should not be lerped independently.