animations: clean up casts for future 16 bit coord support
This commit is contained in:
parent
198aa0ebd0
commit
6fe5fdcc1a
@ -20,7 +20,7 @@ struct SolidShader {}
|
||||
|
||||
impl Shader for SolidShader {
|
||||
fn draw(&self, _coords: &VirtualCoordinates, frame: usize) -> RGB8 {
|
||||
Hsv::new_srgb((frame / 4 % 255) as u8, 255, sin8((frame % 64) as u8)).into_rgb8()
|
||||
Hsv::new_srgb((frame % 255) as u8, 255, sin8((frame % 64) as u8)).into_rgb8()
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ struct ShimmerShader {}
|
||||
|
||||
impl Shader for ShimmerShader {
|
||||
fn draw(&self, coords: &VirtualCoordinates, frame: usize) -> RGB8 {
|
||||
Hsv::new_srgb(coords.x.wrapping_add((frame / 3) as u8), coords.y, sin8(frame as u8 % 255).max(75).min(64)).into_rgb8()
|
||||
Hsv::new_srgb(((coords.x as usize).wrapping_add(frame / 3) % 255) as u8, coords.y, sin8(frame).max(75).min(64)).into_rgb8()
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,14 +40,14 @@ impl Shader for ThinkingShader {
|
||||
fn draw(&self, coords: &VirtualCoordinates, frame: usize) -> RGB8 {
|
||||
//let noise_x = sin8(sin8((frame % 255) as u8).wrapping_add(coords.x));
|
||||
//let noise_y = cos8(cos8((frame % 255) as u8).wrapping_add(coords.y));
|
||||
let offset_x = sin8(((frame % 255) as u8).wrapping_add(coords.x));
|
||||
let offset_y = cos8(((frame % 255) as u8).wrapping_add(coords.y));
|
||||
let offset_x = sin8(frame.wrapping_add(coords.x as usize));
|
||||
let offset_y = cos8(frame.wrapping_add(coords.y as usize));
|
||||
let noise_x = offset_x / 2;
|
||||
let noise_y = offset_y / 2;
|
||||
//let noise_x = coords.x.wrapping_add(offset_x);
|
||||
//let noise_y = coords.y.wrapping_add(offset_y);
|
||||
Hsv::new_srgb(
|
||||
inoise8(noise_x as i16, noise_y as i16),
|
||||
inoise8(offset_x as i16, offset_y as i16),
|
||||
128_u8.saturating_add(inoise8(noise_y as i16, noise_x as i16)),
|
||||
255
|
||||
).into_rgb8()
|
||||
|
Loading…
x
Reference in New Issue
Block a user