From efe7ade90675a1de955f6ed4484770adb71d1a4c Mon Sep 17 00:00:00 2001 From: Michael Sippel Date: Sat, 28 Sep 2024 18:49:22 +0200 Subject: [PATCH] strobe: choose color by wheel parameter --- src/patterns/strobe.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/patterns/strobe.rs b/src/patterns/strobe.rs index eadd9cf..732953a 100644 --- a/src/patterns/strobe.rs +++ b/src/patterns/strobe.rs @@ -28,11 +28,17 @@ impl ColorGrid for Strobe { fn get(&self, p: &Vector2) -> Rgb { let t = (self.inputs.wheel as f32 * self.inputs.t.as_millis() as f32 / self.inputs.cycle_len.as_millis() as f32) % 1.0; - if t < 0.6 { - Rgb::new(0.3, 0.3, 0.3) - } else { - Rgb::new(0.05, 0.05, 0.05) - } + Rgb::from_color( + &Hsv::>::new( + Turns( (self.inputs.wheel.abs() % 256) as f32 / 256.0 ), + 0.9, + if t < 0.6 { + 0.3 + } else { + 1.0 + } + ) + ) } }