diff --git a/src/render.rs b/src/render.rs index 44b5936..ed9b330 100644 --- a/src/render.rs +++ b/src/render.rs @@ -333,28 +333,13 @@ pub trait Lerp { fn lerp(self, other: &Self, diff: f64) -> Self; } -impl Lerp for u8 { - fn lerp(self, other: &Self, diff: f64) -> Self { - - let delta = diff / 1_000_000.0; - - ((self as f64) + (((*other as f64) - (self as f64)) * 0.5 * delta)) as u8 - } -} - impl Lerp for f64 { fn lerp(self, other: &Self, diff: f64) -> Self { - let delta = diff / 1000.0; + let delta = diff / 1_000_000.0; self + ((*other - self) * 0.5 * delta) } } -impl Lerp for RGB { - fn lerp(self, other: &Self, diff: f64) -> Self { - RGB::new(self.r.lerp(&other.r, diff), self.g.lerp(&other.g, diff), self.b.lerp(&other.b, diff)) - } -} - impl Lerp for RGB { fn lerp(self, other: &Self, diff: f64) -> Self { RGB::new(self.r.lerp(&other.r, diff), self.g.lerp(&other.g, diff), self.b.lerp(&other.b, diff))