diff options
author | Albert Y <76888457+filterpaper@users.noreply.github.com> | 2023-06-11 14:55:03 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-10 23:55:03 -0700 |
commit | 3444e9656d031bf23d78b0a4ab56d84ed0f10757 (patch) | |
tree | c9da81cc6d4c30861ac1e8b68b6ee366c7b3f560 /quantum | |
parent | 55f226159b2e06265ccb8f2105ef1c95f2f7f005 (diff) |
Refactor the rain lighting decision operator (#21139)
Diffstat (limited to 'quantum')
-rw-r--r-- | quantum/rgb_matrix/animations/pixel_rain_anim.h | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/quantum/rgb_matrix/animations/pixel_rain_anim.h b/quantum/rgb_matrix/animations/pixel_rain_anim.h index 9d63f451e2..26cd73b578 100644 --- a/quantum/rgb_matrix/animations/pixel_rain_anim.h +++ b/quantum/rgb_matrix/animations/pixel_rain_anim.h @@ -16,13 +16,9 @@ static bool PIXEL_RAIN(effect_params_t* params) { if (!HAS_ANY_FLAGS(g_led_config.flags[led_index], params->flags)) { return; } - if (random8() & 2) { - rgb_matrix_set_color(led_index, 0, 0, 0); - } else { - HSV hsv = {random8(), random8_min_max(127, 255), rgb_matrix_config.hsv.v}; - RGB rgb = rgb_matrix_hsv_to_rgb(hsv); - rgb_matrix_set_color(led_index, rgb.r, rgb.g, rgb.b); - } + HSV hsv = (random8() & 2) ? (HSV){0, 0, 0} : (HSV){random8(), random8_min_max(127, 255), rgb_matrix_config.hsv.v}; + RGB rgb = rgb_matrix_hsv_to_rgb(hsv); + rgb_matrix_set_color(led_index, rgb.r, rgb.g, rgb.b); wait_timer = g_rgb_timer + interval(); } |