diff options
Diffstat (limited to 'quantum')
| -rw-r--r-- | quantum/rgb_matrix/animations/pixel_rain_anim.h | 44 | ||||
| -rw-r--r-- | quantum/rgb_matrix/animations/rgb_matrix_effects.inc | 1 |
2 files changed, 45 insertions, 0 deletions
diff --git a/quantum/rgb_matrix/animations/pixel_rain_anim.h b/quantum/rgb_matrix/animations/pixel_rain_anim.h new file mode 100644 index 000000000..0209d3303 --- /dev/null +++ b/quantum/rgb_matrix/animations/pixel_rain_anim.h | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | /* Copyright (C) 2021 @filterpaper | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #ifdef ENABLE_RGB_MATRIX_PIXEL_RAIN | ||
| 18 | RGB_MATRIX_EFFECT(PIXEL_RAIN) | ||
| 19 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 20 | |||
| 21 | static bool PIXEL_RAIN(effect_params_t* params) { | ||
| 22 | static uint32_t wait_timer = 0; | ||
| 23 | if (wait_timer > g_rgb_timer) { return false; } | ||
| 24 | |||
| 25 | inline uint32_t interval(void) { return 500 / scale16by8(qadd8(rgb_matrix_config.speed, 16), 16); } | ||
| 26 | |||
| 27 | bool rain_pixel(uint8_t i, effect_params_t* params, bool off) { | ||
| 28 | if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) { return true; } | ||
| 29 | if (off) { | ||
| 30 | rgb_matrix_set_color(i, 0,0,0); | ||
| 31 | } else { | ||
| 32 | HSV hsv = {random8(), qadd8(random8() >> 1, 127), rgb_matrix_config.hsv.v}; | ||
| 33 | RGB rgb = rgb_matrix_hsv_to_rgb(hsv); | ||
| 34 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | ||
| 35 | } | ||
| 36 | wait_timer = g_rgb_timer + interval(); | ||
| 37 | return false; | ||
| 38 | } | ||
| 39 | |||
| 40 | return rain_pixel(mod8(random8(), DRIVER_LED_TOTAL), params, random8() & 2); | ||
| 41 | } | ||
| 42 | |||
| 43 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 44 | #endif // ENABLE_RGB_MATRIX_PIXEL_RAIN | ||
diff --git a/quantum/rgb_matrix/animations/rgb_matrix_effects.inc b/quantum/rgb_matrix/animations/rgb_matrix_effects.inc index 33d2b4228..8ecf4367f 100644 --- a/quantum/rgb_matrix/animations/rgb_matrix_effects.inc +++ b/quantum/rgb_matrix/animations/rgb_matrix_effects.inc | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | #include "hue_pendulum_anim.h" | 27 | #include "hue_pendulum_anim.h" |
| 28 | #include "hue_wave_anim.h" | 28 | #include "hue_wave_anim.h" |
| 29 | #include "fractal_anim.h" | 29 | #include "fractal_anim.h" |
| 30 | #include "pixel_rain_anim.h" | ||
| 30 | #include "typing_heatmap_anim.h" | 31 | #include "typing_heatmap_anim.h" |
| 31 | #include "digital_rain_anim.h" | 32 | #include "digital_rain_anim.h" |
| 32 | #include "solid_reactive_simple_anim.h" | 33 | #include "solid_reactive_simple_anim.h" |
