From 16ea28557e1c1ce76cfa6fe1236adac1c956c982 Mon Sep 17 00:00:00 2001 From: Andre Henriques Date: Wed, 15 Mar 2023 22:52:45 +0000 Subject: [PATCH] update delta diff --- src/render.rs | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) 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))