From 29efa6be830e711485bae44b905b151facc57ea6 Mon Sep 17 00:00:00 2001 From: Andre Henriques Date: Wed, 15 Mar 2023 23:14:41 +0000 Subject: [PATCH] change values to u128 --- src/render.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/render.rs b/src/render.rs index 8269170..bae1077 100644 --- a/src/render.rs +++ b/src/render.rs @@ -23,7 +23,7 @@ pub struct LigthSetting { #[derive(Clone)] pub struct KeyFrame { - duration: u64, + duration: u128, settings: Vec } @@ -34,7 +34,7 @@ pub struct RenderAnimation { name: String, current_frame: usize, - start_time: u64, + start_time: u128, reset: bool, } @@ -42,7 +42,7 @@ pub struct Render { conn: DBPool, num_leds: u32, - last_render: u64, + last_render: u128, ws: Option, last: Vec>, @@ -176,7 +176,7 @@ impl Render { }); } - key_frames.push(KeyFrame { duration: frame.get_duration().into(), settings: light_settings }) + key_frames.push(KeyFrame { duration: (frame.get_duration() as u128) * (1000 as u128), settings: light_settings }) } let new_animation = RenderAnimation { @@ -236,7 +236,7 @@ impl Render { let mut data: Vec> = vec![RGB::default(); self.num_leds.try_into().unwrap()]; - let time = SystemTime::now().duration_since(UNIX_EPOCH).expect("Time went backwards").as_secs(); + let time = SystemTime::now().duration_since(UNIX_EPOCH).expect("Time went backwards").as_millis(); if self.last_render == 0 { self.last_render = time; @@ -331,7 +331,7 @@ pub trait Lerp { impl Lerp for f64 { fn lerp(self, other: &Self, diff: f64) -> Self { - let delta = diff; + let delta = diff / 1000.0; let change = (*other - self) * 0.2 * delta;