fix(rainbow): name variables
This commit is contained in:
parent
f63fd2dff2
commit
bc6c014b68
1 changed files with 10 additions and 2 deletions
12
src/main.rs
12
src/main.rs
|
@ -143,9 +143,17 @@ fn rainbow(layout: Layout, frame: u32) -> RgbImage {
|
||||||
let w = layout.width_px();
|
let w = layout.width_px();
|
||||||
let h = layout.height_px();
|
let h = layout.height_px();
|
||||||
|
|
||||||
|
let tightness = 100.0;
|
||||||
|
let slowness = 200;
|
||||||
|
let brightness = 0.1;
|
||||||
|
|
||||||
RgbImage::from_fn(w, h, |x, y| {
|
RgbImage::from_fn(w, h, |x, y| {
|
||||||
let RGB { r, g, b } =
|
let RGB { r, g, b } = HSV::from_f32(
|
||||||
HSV::from_f32((x + y + frame % 100) as f32 / 100.0 % 1.0, 1.0, 0.1).to_rgb();
|
(x + y) as f32 / tightness % 1.0 + (frame % slowness) as f32 / slowness as f32,
|
||||||
|
1.0,
|
||||||
|
brightness,
|
||||||
|
)
|
||||||
|
.to_rgb();
|
||||||
Rgb([(r * 255.0) as u8, (g * 255.0) as u8, (b * 255.0) as u8])
|
Rgb([(r * 255.0) as u8, (g * 255.0) as u8, (b * 255.0) as u8])
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue