diff options
author | XScorpion2 <rcalt2vt@gmail.com> | 2019-05-19 11:09:06 -0500 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2019-05-19 09:09:06 -0700 |
commit | 0099bbf9a64a0b4df1093f528481bff39af2c80d (patch) | |
tree | f9198bfb1124992267915d2f75c1214c94235f4a /quantum/rgb_matrix_animations/colorband_sat_anim.h | |
parent | ba26736d7e0679e87e34add2445cdae541e2a0b8 (diff) | |
download | firmware-0099bbf9a64a0b4df1093f528481bff39af2c80d.tar.gz firmware-0099bbf9a64a0b4df1093f528481bff39af2c80d.tar.bz2 firmware-0099bbf9a64a0b4df1093f528481bff39af2c80d.zip |
Single Color Band scrolling left to right effects (#5867)
Diffstat (limited to 'quantum/rgb_matrix_animations/colorband_sat_anim.h')
-rw-r--r-- | quantum/rgb_matrix_animations/colorband_sat_anim.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/quantum/rgb_matrix_animations/colorband_sat_anim.h b/quantum/rgb_matrix_animations/colorband_sat_anim.h new file mode 100644 index 000000000..89773b6ce --- /dev/null +++ b/quantum/rgb_matrix_animations/colorband_sat_anim.h @@ -0,0 +1,21 @@ +#ifndef DISABLE_RGB_MATRIX_BAND_SAT +RGB_MATRIX_EFFECT(BAND_SAT) +#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS + +bool BAND_SAT(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + HSV hsv = { rgb_matrix_config.hue, 0, rgb_matrix_config.val }; + uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4); + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + int16_t s = rgb_matrix_config.sat - abs(scale8(g_led_config.point[i].x, 228) + 28 - time) * 8; + hsv.s = s < 0 ? 0 : s; + RGB rgb = hsv_to_rgb(hsv); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + return led_max < DRIVER_LED_TOTAL; +} + +#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // DISABLE_RGB_MATRIX_BAND_SAT |