diff options
Diffstat (limited to 'quantum/led_matrix_animations')
18 files changed, 362 insertions, 0 deletions
diff --git a/quantum/led_matrix_animations/alpha_mods_anim.h b/quantum/led_matrix_animations/alpha_mods_anim.h new file mode 100644 index 000000000..a4638fde6 --- /dev/null +++ b/quantum/led_matrix_animations/alpha_mods_anim.h | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | #ifndef DISABLE_LED_MATRIX_ALPHAS_MODS | ||
| 2 | LED_MATRIX_EFFECT(ALPHAS_MODS) | ||
| 3 | # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 4 | |||
| 5 | // alphas = val1, mods = val2 | ||
| 6 | bool ALPHAS_MODS(effect_params_t* params) { | ||
| 7 | LED_MATRIX_USE_LIMITS(led_min, led_max); | ||
| 8 | |||
| 9 | uint8_t val1 = led_matrix_eeconfig.val; | ||
| 10 | uint8_t val2 = val1 + led_matrix_eeconfig.speed; | ||
| 11 | |||
| 12 | for (uint8_t i = led_min; i < led_max; i++) { | ||
| 13 | LED_MATRIX_TEST_LED_FLAGS(); | ||
| 14 | if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { | ||
| 15 | led_matrix_set_value(i, val2); | ||
| 16 | } else { | ||
| 17 | led_matrix_set_value(i, val1); | ||
| 18 | } | ||
| 19 | } | ||
| 20 | return led_max < DRIVER_LED_TOTAL; | ||
| 21 | } | ||
| 22 | |||
| 23 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 24 | #endif // DISABLE_LED_MATRIX_ALPHAS_MODS | ||
diff --git a/quantum/led_matrix_animations/band_anim.h b/quantum/led_matrix_animations/band_anim.h new file mode 100644 index 000000000..4a2b746a7 --- /dev/null +++ b/quantum/led_matrix_animations/band_anim.h | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | #ifndef DISABLE_LED_MATRIX_BAND | ||
| 2 | LED_MATRIX_EFFECT(BAND) | ||
| 3 | # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 4 | |||
| 5 | static uint8_t BAND_math(uint8_t val, uint8_t i, uint8_t time) { | ||
| 6 | int16_t v = val - abs(scale8(g_led_config.point[i].x, 228) + 28 - time) * 8; | ||
| 7 | return scale8(v < 0 ? 0 : v, val); | ||
| 8 | } | ||
| 9 | |||
| 10 | bool BAND(effect_params_t* params) { | ||
| 11 | return effect_runner_i(params, &BAND_math); | ||
| 12 | } | ||
| 13 | |||
| 14 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 15 | #endif // DISABLE_LED_MATRIX_BAND | ||
diff --git a/quantum/led_matrix_animations/band_pinwheel_anim.h b/quantum/led_matrix_animations/band_pinwheel_anim.h new file mode 100644 index 000000000..9836320d2 --- /dev/null +++ b/quantum/led_matrix_animations/band_pinwheel_anim.h | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | #ifndef DISABLE_LED_MATRIX_BAND_PINWHEEL | ||
| 2 | LED_MATRIX_EFFECT(BAND_PINWHEEL) | ||
| 3 | # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 4 | |||
| 5 | static uint8_t BAND_PINWHEEL_math(uint8_t val, int16_t dx, int16_t dy, uint8_t time) { | ||
| 6 | return scale8(val - time - atan2_8(dy, dx) * 3, val); | ||
| 7 | } | ||
| 8 | |||
| 9 | bool BAND_PINWHEEL(effect_params_t* params) { | ||
| 10 | return effect_runner_dx_dy(params, &BAND_PINWHEEL_math); | ||
| 11 | } | ||
| 12 | |||
| 13 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 14 | #endif // DISABLE_LED_MATRIX_BAND_PINWHEEL | ||
diff --git a/quantum/led_matrix_animations/band_spiral_anim.h b/quantum/led_matrix_animations/band_spiral_anim.h new file mode 100644 index 000000000..be17c03aa --- /dev/null +++ b/quantum/led_matrix_animations/band_spiral_anim.h | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | #ifndef DISABLE_LED_MATRIX_BAND_SPIRAL | ||
| 2 | LED_MATRIX_EFFECT(BAND_SPIRAL) | ||
| 3 | # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 4 | |||
| 5 | static uint8_t BAND_SPIRAL_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { | ||
| 6 | return scale8(val + dist - time - atan2_8(dy, dx), val); | ||
| 7 | } | ||
| 8 | |||
| 9 | bool BAND_SPIRAL(effect_params_t* params) { | ||
| 10 | return effect_runner_dx_dy_dist(params, &BAND_SPIRAL_math); | ||
| 11 | } | ||
| 12 | |||
| 13 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 14 | #endif // DISABLE_LED_MATRIX_BAND_SPIRAL | ||
diff --git a/quantum/led_matrix_animations/breathing_anim.h b/quantum/led_matrix_animations/breathing_anim.h new file mode 100644 index 000000000..4f49f5069 --- /dev/null +++ b/quantum/led_matrix_animations/breathing_anim.h | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | #ifndef DISABLE_LED_MATRIX_BREATHING | ||
| 2 | LED_MATRIX_EFFECT(BREATHING) | ||
| 3 | # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 4 | |||
| 5 | bool BREATHING(effect_params_t* params) { | ||
| 6 | LED_MATRIX_USE_LIMITS(led_min, led_max); | ||
| 7 | |||
| 8 | uint8_t val = led_matrix_eeconfig.val; | ||
| 9 | uint16_t time = scale16by8(g_led_timer, led_matrix_eeconfig.speed / 8); | ||
| 10 | val = scale8(abs8(sin8(time) - 128) * 2, val); | ||
| 11 | for (uint8_t i = led_min; i < led_max; i++) { | ||
| 12 | LED_MATRIX_TEST_LED_FLAGS(); | ||
| 13 | led_matrix_set_value(i, val); | ||
| 14 | } | ||
| 15 | return led_max < DRIVER_LED_TOTAL; | ||
| 16 | } | ||
| 17 | |||
| 18 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 19 | #endif // DISABLE_LED_MATRIX_BREATHING | ||
diff --git a/quantum/led_matrix_animations/cycle_left_right_anim.h b/quantum/led_matrix_animations/cycle_left_right_anim.h new file mode 100644 index 000000000..404fda26f --- /dev/null +++ b/quantum/led_matrix_animations/cycle_left_right_anim.h | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | #ifndef DISABLE_LED_MATRIX_CYCLE_LEFT_RIGHT | ||
| 2 | LED_MATRIX_EFFECT(CYCLE_LEFT_RIGHT) | ||
| 3 | # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 4 | |||
| 5 | static uint8_t CYCLE_LEFT_RIGHT_math(uint8_t val, uint8_t i, uint8_t time) { | ||
| 6 | return scale8(g_led_config.point[i].x - time, val); | ||
| 7 | } | ||
| 8 | |||
| 9 | bool CYCLE_LEFT_RIGHT(effect_params_t* params) { | ||
| 10 | return effect_runner_i(params, &CYCLE_LEFT_RIGHT_math); | ||
| 11 | } | ||
| 12 | |||
| 13 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 14 | #endif // DISABLE_LED_MATRIX_CYCLE_LEFT_RIGHT | ||
diff --git a/quantum/led_matrix_animations/cycle_out_in_anim.h b/quantum/led_matrix_animations/cycle_out_in_anim.h new file mode 100644 index 000000000..3f5fc5b18 --- /dev/null +++ b/quantum/led_matrix_animations/cycle_out_in_anim.h | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | #ifndef DISABLE_LED_MATRIX_CYCLE_OUT_IN | ||
| 2 | LED_MATRIX_EFFECT(CYCLE_OUT_IN) | ||
| 3 | # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 4 | |||
| 5 | static uint8_t CYCLE_OUT_IN_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { | ||
| 6 | return scale8(3 * dist / 2 + time, val); | ||
| 7 | } | ||
| 8 | |||
| 9 | bool CYCLE_OUT_IN(effect_params_t* params) { | ||
| 10 | return effect_runner_dx_dy_dist(params, &CYCLE_OUT_IN_math); | ||
| 11 | } | ||
| 12 | |||
| 13 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 14 | #endif // DISABLE_LED_MATRIX_CYCLE_OUT_IN | ||
diff --git a/quantum/led_matrix_animations/cycle_up_down_anim.h b/quantum/led_matrix_animations/cycle_up_down_anim.h new file mode 100644 index 000000000..25fc211b1 --- /dev/null +++ b/quantum/led_matrix_animations/cycle_up_down_anim.h | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | #ifndef DISABLE_LED_MATRIX_CYCLE_UP_DOWN | ||
| 2 | LED_MATRIX_EFFECT(CYCLE_UP_DOWN) | ||
| 3 | # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 4 | |||
| 5 | static uint8_t CYCLE_UP_DOWN_math(uint8_t val, uint8_t i, uint8_t time) { | ||
| 6 | return scale8(g_led_config.point[i].y - time, val); | ||
| 7 | } | ||
| 8 | |||
| 9 | bool CYCLE_UP_DOWN(effect_params_t* params) { | ||
| 10 | return effect_runner_i(params, &CYCLE_UP_DOWN_math); | ||
| 11 | } | ||
| 12 | |||
| 13 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 14 | #endif // DISABLE_LED_MATRIX_CYCLE_UP_DOWN | ||
diff --git a/quantum/led_matrix_animations/dual_beacon_anim.h b/quantum/led_matrix_animations/dual_beacon_anim.h new file mode 100644 index 000000000..1fa1df139 --- /dev/null +++ b/quantum/led_matrix_animations/dual_beacon_anim.h | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | #ifndef DISABLE_LED_MATRIX_DUAL_BEACON | ||
| 2 | LED_MATRIX_EFFECT(DUAL_BEACON) | ||
| 3 | # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 4 | |||
| 5 | static uint8_t DUAL_BEACON_math(uint8_t val, int8_t sin, int8_t cos, uint8_t i, uint8_t time) { | ||
| 6 | return scale8(((g_led_config.point[i].y - k_led_matrix_center.y) * cos + (g_led_config.point[i].x - k_led_matrix_center.x) * sin) / 128, val); | ||
| 7 | } | ||
| 8 | |||
| 9 | bool DUAL_BEACON(effect_params_t* params) { | ||
| 10 | return effect_runner_sin_cos_i(params, &DUAL_BEACON_math); | ||
| 11 | } | ||
| 12 | |||
| 13 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 14 | #endif // DISABLE_LED_MATRIX_DUAL_BEACON | ||
diff --git a/quantum/led_matrix_animations/led_matrix_effects.inc b/quantum/led_matrix_animations/led_matrix_effects.inc new file mode 100644 index 000000000..67237c568 --- /dev/null +++ b/quantum/led_matrix_animations/led_matrix_effects.inc | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | // Add your new core led matrix effect here, order determins enum order, requires "led_matrix_animations/ directory | ||
| 2 | #include "led_matrix_animations/solid_anim.h" | ||
| 3 | #include "led_matrix_animations/alpha_mods_anim.h" | ||
| 4 | #include "led_matrix_animations/breathing_anim.h" | ||
| 5 | #include "led_matrix_animations/band_anim.h" | ||
| 6 | #include "led_matrix_animations/band_pinwheel_anim.h" | ||
| 7 | #include "led_matrix_animations/band_spiral_anim.h" | ||
| 8 | #include "led_matrix_animations/cycle_left_right_anim.h" | ||
| 9 | #include "led_matrix_animations/cycle_up_down_anim.h" | ||
| 10 | #include "led_matrix_animations/cycle_out_in_anim.h" | ||
| 11 | #include "led_matrix_animations/dual_beacon_anim.h" | ||
| 12 | #include "led_matrix_animations/solid_reactive_simple_anim.h" | ||
| 13 | #include "led_matrix_animations/solid_reactive_wide.h" | ||
| 14 | #include "led_matrix_animations/solid_reactive_cross.h" | ||
| 15 | #include "led_matrix_animations/solid_reactive_nexus.h" | ||
| 16 | #include "led_matrix_animations/solid_splash_anim.h" | ||
| 17 | #include "led_matrix_animations/wave_left_right_anim.h" | ||
| 18 | #include "led_matrix_animations/wave_up_down_anim.h" | ||
diff --git a/quantum/led_matrix_animations/solid_anim.h b/quantum/led_matrix_animations/solid_anim.h new file mode 100644 index 000000000..4c9e43c58 --- /dev/null +++ b/quantum/led_matrix_animations/solid_anim.h | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | LED_MATRIX_EFFECT(SOLID) | ||
| 2 | #ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 3 | |||
| 4 | bool SOLID(effect_params_t* params) { | ||
| 5 | LED_MATRIX_USE_LIMITS(led_min, led_max); | ||
| 6 | |||
| 7 | uint8_t val = led_matrix_eeconfig.val; | ||
| 8 | for (uint8_t i = led_min; i < led_max; i++) { | ||
| 9 | LED_MATRIX_TEST_LED_FLAGS(); | ||
| 10 | led_matrix_set_value(i, val); | ||
| 11 | } | ||
| 12 | return led_max < DRIVER_LED_TOTAL; | ||
| 13 | } | ||
| 14 | |||
| 15 | #endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
diff --git a/quantum/led_matrix_animations/solid_reactive_cross.h b/quantum/led_matrix_animations/solid_reactive_cross.h new file mode 100644 index 000000000..a50d1fc62 --- /dev/null +++ b/quantum/led_matrix_animations/solid_reactive_cross.h | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | #ifdef LED_MATRIX_KEYREACTIVE_ENABLED | ||
| 2 | # if !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS) | ||
| 3 | |||
| 4 | # ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS | ||
| 5 | LED_MATRIX_EFFECT(SOLID_REACTIVE_CROSS) | ||
| 6 | # endif | ||
| 7 | |||
| 8 | # ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS | ||
| 9 | LED_MATRIX_EFFECT(SOLID_REACTIVE_MULTICROSS) | ||
| 10 | # endif | ||
| 11 | |||
| 12 | # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 13 | |||
| 14 | static uint8_t SOLID_REACTIVE_CROSS_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { | ||
| 15 | uint16_t effect = tick + dist; | ||
| 16 | dx = dx < 0 ? dx * -1 : dx; | ||
| 17 | dy = dy < 0 ? dy * -1 : dy; | ||
| 18 | dx = dx * 16 > 255 ? 255 : dx * 16; | ||
| 19 | dy = dy * 16 > 255 ? 255 : dy * 16; | ||
| 20 | effect += dx > dy ? dy : dx; | ||
| 21 | if (effect > 255) effect = 255; | ||
| 22 | return qadd8(val, 255 - effect); | ||
| 23 | } | ||
| 24 | |||
| 25 | # ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS | ||
| 26 | bool SOLID_REACTIVE_CROSS(effect_params_t* params) { | ||
| 27 | return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_CROSS_math); | ||
| 28 | } | ||
| 29 | # endif | ||
| 30 | |||
| 31 | # ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS | ||
| 32 | bool SOLID_REACTIVE_MULTICROSS(effect_params_t* params) { | ||
| 33 | return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_CROSS_math); | ||
| 34 | } | ||
| 35 | # endif | ||
| 36 | |||
| 37 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 38 | # endif // !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS) | ||
| 39 | #endif // LED_MATRIX_KEYREACTIVE_ENABLED | ||
diff --git a/quantum/led_matrix_animations/solid_reactive_nexus.h b/quantum/led_matrix_animations/solid_reactive_nexus.h new file mode 100644 index 000000000..4638aac5a --- /dev/null +++ b/quantum/led_matrix_animations/solid_reactive_nexus.h | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | #ifdef LED_MATRIX_KEYREACTIVE_ENABLED | ||
| 2 | # if !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS) | ||
| 3 | |||
| 4 | # ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS | ||
| 5 | LED_MATRIX_EFFECT(SOLID_REACTIVE_NEXUS) | ||
| 6 | # endif | ||
| 7 | |||
| 8 | # ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS | ||
| 9 | LED_MATRIX_EFFECT(SOLID_REACTIVE_MULTINEXUS) | ||
| 10 | # endif | ||
| 11 | |||
| 12 | # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 13 | |||
| 14 | static uint8_t SOLID_REACTIVE_NEXUS_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { | ||
| 15 | uint16_t effect = tick - dist; | ||
| 16 | if (effect > 255) effect = 255; | ||
| 17 | if (dist > 72) effect = 255; | ||
| 18 | if ((dx > 8 || dx < -8) && (dy > 8 || dy < -8)) effect = 255; | ||
| 19 | return qadd8(val, 255 - effect); | ||
| 20 | } | ||
| 21 | |||
| 22 | # ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS | ||
| 23 | bool SOLID_REACTIVE_NEXUS(effect_params_t* params) { | ||
| 24 | return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_NEXUS_math); | ||
| 25 | } | ||
| 26 | # endif | ||
| 27 | |||
| 28 | # ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS | ||
| 29 | bool SOLID_REACTIVE_MULTINEXUS(effect_params_t* params) { | ||
| 30 | return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_NEXUS_math); | ||
| 31 | } | ||
| 32 | # endif | ||
| 33 | |||
| 34 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 35 | # endif // !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS) | ||
| 36 | #endif // LED_MATRIX_KEYREACTIVE_ENABLED | ||
diff --git a/quantum/led_matrix_animations/solid_reactive_simple_anim.h b/quantum/led_matrix_animations/solid_reactive_simple_anim.h new file mode 100644 index 000000000..e1166a4fb --- /dev/null +++ b/quantum/led_matrix_animations/solid_reactive_simple_anim.h | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | #ifdef LED_MATRIX_KEYREACTIVE_ENABLED | ||
| 2 | # ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE | ||
| 3 | LED_MATRIX_EFFECT(SOLID_REACTIVE_SIMPLE) | ||
| 4 | # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 5 | |||
| 6 | static uint8_t SOLID_REACTIVE_SIMPLE_math(uint8_t val, uint16_t offset) { | ||
| 7 | return scale8(255 - offset, val); | ||
| 8 | } | ||
| 9 | |||
| 10 | bool SOLID_REACTIVE_SIMPLE(effect_params_t* params) { | ||
| 11 | return effect_runner_reactive(params, &SOLID_REACTIVE_SIMPLE_math); | ||
| 12 | } | ||
| 13 | |||
| 14 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 15 | # endif // DISABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE | ||
| 16 | #endif // LED_MATRIX_KEYREACTIVE_ENABLED | ||
diff --git a/quantum/led_matrix_animations/solid_reactive_wide.h b/quantum/led_matrix_animations/solid_reactive_wide.h new file mode 100644 index 000000000..4bcaba331 --- /dev/null +++ b/quantum/led_matrix_animations/solid_reactive_wide.h | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | #ifdef LED_MATRIX_KEYREACTIVE_ENABLED | ||
| 2 | # if !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE) | ||
| 3 | |||
| 4 | # ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE | ||
| 5 | LED_MATRIX_EFFECT(SOLID_REACTIVE_WIDE) | ||
| 6 | # endif | ||
| 7 | |||
| 8 | # ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE | ||
| 9 | LED_MATRIX_EFFECT(SOLID_REACTIVE_MULTIWIDE) | ||
| 10 | # endif | ||
| 11 | |||
| 12 | # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 13 | |||
| 14 | static uint8_t SOLID_REACTIVE_WIDE_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { | ||
| 15 | uint16_t effect = tick + dist * 5; | ||
| 16 | if (effect > 255) effect = 255; | ||
| 17 | return qadd8(val, 255 - effect); | ||
| 18 | } | ||
| 19 | |||
| 20 | # ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE | ||
| 21 | bool SOLID_REACTIVE_WIDE(effect_params_t* params) { | ||
| 22 | return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_WIDE_math); | ||
| 23 | } | ||
| 24 | # endif | ||
| 25 | |||
| 26 | # ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE | ||
| 27 | bool SOLID_REACTIVE_MULTIWIDE(effect_params_t* params) { | ||
| 28 | return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_WIDE_math); | ||
| 29 | } | ||
| 30 | # endif | ||
| 31 | |||
| 32 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 33 | # endif // !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE) | ||
| 34 | #endif // LED_MATRIX_KEYREACTIVE_ENABLED | ||
diff --git a/quantum/led_matrix_animations/solid_splash_anim.h b/quantum/led_matrix_animations/solid_splash_anim.h new file mode 100644 index 000000000..3e9046640 --- /dev/null +++ b/quantum/led_matrix_animations/solid_splash_anim.h | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | #ifdef LED_MATRIX_KEYREACTIVE_ENABLED | ||
| 2 | # if !defined(DISABLE_LED_MATRIX_SOLID_SPLASH) || !defined(DISABLE_LED_MATRIX_SOLID_MULTISPLASH) | ||
| 3 | |||
| 4 | # ifndef DISABLE_LED_MATRIX_SOLID_SPLASH | ||
| 5 | LED_MATRIX_EFFECT(SOLID_SPLASH) | ||
| 6 | # endif | ||
| 7 | |||
| 8 | # ifndef DISABLE_LED_MATRIX_SOLID_MULTISPLASH | ||
| 9 | LED_MATRIX_EFFECT(SOLID_MULTISPLASH) | ||
| 10 | # endif | ||
| 11 | |||
| 12 | # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 13 | |||
| 14 | uint8_t SOLID_SPLASH_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { | ||
| 15 | uint16_t effect = tick - dist; | ||
| 16 | if (effect > 255) effect = 255; | ||
| 17 | return qadd8(val, 255 - effect); | ||
| 18 | } | ||
| 19 | |||
| 20 | # ifndef DISABLE_LED_MATRIX_SOLID_SPLASH | ||
| 21 | bool SOLID_SPLASH(effect_params_t* params) { | ||
| 22 | return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_SPLASH_math); | ||
| 23 | } | ||
| 24 | # endif | ||
| 25 | |||
| 26 | # ifndef DISABLE_LED_MATRIX_SOLID_MULTISPLASH | ||
| 27 | bool SOLID_MULTISPLASH(effect_params_t* params) { | ||
| 28 | return effect_runner_reactive_splash(0, params, &SOLID_SPLASH_math); | ||
| 29 | } | ||
| 30 | # endif | ||
| 31 | |||
| 32 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 33 | # endif // !defined(DISABLE_LED_MATRIX_SPLASH) && !defined(DISABLE_LED_MATRIX_MULTISPLASH) | ||
| 34 | #endif // LED_MATRIX_KEYREACTIVE_ENABLED | ||
diff --git a/quantum/led_matrix_animations/wave_left_right_anim.h b/quantum/led_matrix_animations/wave_left_right_anim.h new file mode 100644 index 000000000..d547c72ce --- /dev/null +++ b/quantum/led_matrix_animations/wave_left_right_anim.h | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | #ifndef DISABLE_LED_MATRIX_WAVE_LEFT_RIGHT | ||
| 2 | LED_MATRIX_EFFECT(WAVE_LEFT_RIGHT) | ||
| 3 | # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 4 | |||
| 5 | static uint8_t WAVE_LEFT_RIGHT_math(uint8_t val, uint8_t i, uint8_t time) { | ||
| 6 | return scale8(sin8(g_led_config.point[i].x - time), val); | ||
| 7 | } | ||
| 8 | |||
| 9 | bool WAVE_LEFT_RIGHT(effect_params_t* params) { | ||
| 10 | return effect_runner_i(params, &WAVE_LEFT_RIGHT_math); | ||
| 11 | } | ||
| 12 | |||
| 13 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 14 | #endif // DISABLE_LED_MATRIX_WAVE_LEFT_RIGHT | ||
diff --git a/quantum/led_matrix_animations/wave_up_down_anim.h b/quantum/led_matrix_animations/wave_up_down_anim.h new file mode 100644 index 000000000..b68ff9bbc --- /dev/null +++ b/quantum/led_matrix_animations/wave_up_down_anim.h | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | #ifndef DISABLE_LED_MATRIX_WAVE_UP_DOWN | ||
| 2 | LED_MATRIX_EFFECT(WAVE_UP_DOWN) | ||
| 3 | # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 4 | |||
| 5 | static uint8_t WAVE_UP_DOWN_math(uint8_t val, uint8_t i, uint8_t time) { | ||
| 6 | return scale8(sin8(g_led_config.point[i].y - time), val); | ||
| 7 | } | ||
| 8 | |||
| 9 | bool WAVE_UP_DOWN(effect_params_t* params) { | ||
| 10 | return effect_runner_i(params, &WAVE_UP_DOWN_math); | ||
| 11 | } | ||
| 12 | |||
| 13 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 14 | #endif // DISABLE_LED_MATRIX_WAVE_UP_DOWN | ||
