strobe: choose color by wheel parameter

This commit is contained in:
Michael Sippel 2024-09-28 18:49:22 +02:00
parent 67d7afbd78
commit efe7ade906

View file

@ -28,11 +28,17 @@ impl ColorGrid for Strobe {
fn get(&self, p: &Vector2<f32>) -> Rgb<f32> {
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::<f32, Turns<f32>>::new(
Turns( (self.inputs.wheel.abs() % 256) as f32 / 256.0 ),
0.9,
if t < 0.6 {
0.3
} else {
1.0
}
)
)
}
}