Simplify hue calculation in raindrops animation (#25587)
This commit is contained in:
parent
248d7c1d6d
commit
d8ce8cd204
1 changed files with 2 additions and 7 deletions
|
|
@ -7,14 +7,9 @@ static void raindrops_set_color(uint8_t i, effect_params_t* params) {
|
|||
hsv_t hsv = rgb_matrix_config.hsv;
|
||||
|
||||
// Take the shortest path between hues
|
||||
int16_t deltaH = ((hsv.h + 180) % 360 - hsv.h) / 4;
|
||||
if (deltaH > 127) {
|
||||
deltaH -= 256;
|
||||
} else if (deltaH < -127) {
|
||||
deltaH += 256;
|
||||
}
|
||||
|
||||
int8_t deltaH = (int8_t)((hsv.h + 128) - hsv.h) / 4;
|
||||
hsv.h += (deltaH * random8_max(3));
|
||||
|
||||
rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue