aboutsummaryrefslogtreecommitdiff
path: root/quantum/rgb_matrix/animations/jellybean_raindrops_anim.h
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/rgb_matrix/animations/jellybean_raindrops_anim.h')
-rw-r--r--quantum/rgb_matrix/animations/jellybean_raindrops_anim.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/quantum/rgb_matrix/animations/jellybean_raindrops_anim.h b/quantum/rgb_matrix/animations/jellybean_raindrops_anim.h
new file mode 100644
index 000000000..a17e954b1
--- /dev/null
+++ b/quantum/rgb_matrix/animations/jellybean_raindrops_anim.h
@@ -0,0 +1,29 @@
1#ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
2RGB_MATRIX_EFFECT(JELLYBEAN_RAINDROPS)
3# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
4
5static void jellybean_raindrops_set_color(int i, effect_params_t* params) {
6 if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return;
7 HSV hsv = {rand() & 0xFF, qadd8(rand() & 0x7F, 0x80), rgb_matrix_config.hsv.v};
8 RGB rgb = rgb_matrix_hsv_to_rgb(hsv);
9 rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
10}
11
12bool JELLYBEAN_RAINDROPS(effect_params_t* params) {
13 if (!params->init) {
14 // Change one LED every tick, make sure speed is not 0
15 if (scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 16)) % 5 == 0) {
16 jellybean_raindrops_set_color(rand() % DRIVER_LED_TOTAL, params);
17 }
18 return false;
19 }
20
21 RGB_MATRIX_USE_LIMITS(led_min, led_max);
22 for (int i = led_min; i < led_max; i++) {
23 jellybean_raindrops_set_color(i, params);
24 }
25 return led_max < DRIVER_LED_TOTAL;
26}
27
28# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
29#endif // DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS