diff options
Diffstat (limited to 'quantum/led_matrix/animations')
25 files changed, 431 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..f9cb85dc4 --- /dev/null +++ b/quantum/led_matrix/animations/band_anim.h | |||
@@ -0,0 +1,13 @@ | |||
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) { return effect_runner_i(params, &BAND_math); } | ||
11 | |||
12 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
13 | #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..d3144bffb --- /dev/null +++ b/quantum/led_matrix/animations/band_pinwheel_anim.h | |||
@@ -0,0 +1,10 @@ | |||
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) { return scale8(val - time - atan2_8(dy, dx) * 3, val); } | ||
6 | |||
7 | bool BAND_PINWHEEL(effect_params_t* params) { return effect_runner_dx_dy(params, &BAND_PINWHEEL_math); } | ||
8 | |||
9 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
10 | #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..defbe6967 --- /dev/null +++ b/quantum/led_matrix/animations/band_spiral_anim.h | |||
@@ -0,0 +1,10 @@ | |||
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) { return scale8(val + dist - time - atan2_8(dy, dx), val); } | ||
6 | |||
7 | bool BAND_SPIRAL(effect_params_t* params) { return effect_runner_dx_dy_dist(params, &BAND_SPIRAL_math); } | ||
8 | |||
9 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
10 | #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..c426d02fd --- /dev/null +++ b/quantum/led_matrix/animations/cycle_left_right_anim.h | |||
@@ -0,0 +1,10 @@ | |||
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) { return scale8(g_led_config.point[i].x - time, val); } | ||
6 | |||
7 | bool CYCLE_LEFT_RIGHT(effect_params_t* params) { return effect_runner_i(params, &CYCLE_LEFT_RIGHT_math); } | ||
8 | |||
9 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
10 | #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..55527556f --- /dev/null +++ b/quantum/led_matrix/animations/cycle_out_in_anim.h | |||
@@ -0,0 +1,10 @@ | |||
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) { return scale8(3 * dist / 2 + time, val); } | ||
6 | |||
7 | bool CYCLE_OUT_IN(effect_params_t* params) { return effect_runner_dx_dy_dist(params, &CYCLE_OUT_IN_math); } | ||
8 | |||
9 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
10 | #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..d97de0d1e --- /dev/null +++ b/quantum/led_matrix/animations/cycle_up_down_anim.h | |||
@@ -0,0 +1,10 @@ | |||
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) { return scale8(g_led_config.point[i].y - time, val); } | ||
6 | |||
7 | bool CYCLE_UP_DOWN(effect_params_t* params) { return effect_runner_i(params, &CYCLE_UP_DOWN_math); } | ||
8 | |||
9 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
10 | #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..e1bc5ae46 --- /dev/null +++ b/quantum/led_matrix/animations/dual_beacon_anim.h | |||
@@ -0,0 +1,10 @@ | |||
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) { 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); } | ||
6 | |||
7 | bool DUAL_BEACON(effect_params_t* params) { return effect_runner_sin_cos_i(params, &DUAL_BEACON_math); } | ||
8 | |||
9 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
10 | #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..ad1f46b24 --- /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 determines enum order | ||
2 | #include "solid_anim.h" | ||
3 | #include "alpha_mods_anim.h" | ||
4 | #include "breathing_anim.h" | ||
5 | #include "band_anim.h" | ||
6 | #include "band_pinwheel_anim.h" | ||
7 | #include "band_spiral_anim.h" | ||
8 | #include "cycle_left_right_anim.h" | ||
9 | #include "cycle_up_down_anim.h" | ||
10 | #include "cycle_out_in_anim.h" | ||
11 | #include "dual_beacon_anim.h" | ||
12 | #include "solid_reactive_simple_anim.h" | ||
13 | #include "solid_reactive_wide.h" | ||
14 | #include "solid_reactive_cross.h" | ||
15 | #include "solid_reactive_nexus.h" | ||
16 | #include "solid_splash_anim.h" | ||
17 | #include "wave_left_right_anim.h" | ||
18 | #include "wave_up_down_anim.h" | ||
diff --git a/quantum/led_matrix/animations/runners/effect_runner_dx_dy.h b/quantum/led_matrix/animations/runners/effect_runner_dx_dy.h new file mode 100644 index 000000000..ef97631b9 --- /dev/null +++ b/quantum/led_matrix/animations/runners/effect_runner_dx_dy.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #pragma once | ||
2 | |||
3 | typedef uint8_t (*dx_dy_f)(uint8_t val, int16_t dx, int16_t dy, uint8_t time); | ||
4 | |||
5 | bool effect_runner_dx_dy(effect_params_t* params, dx_dy_f effect_func) { | ||
6 | LED_MATRIX_USE_LIMITS(led_min, led_max); | ||
7 | |||
8 | uint8_t time = scale16by8(g_led_timer, led_matrix_eeconfig.speed / 2); | ||
9 | for (uint8_t i = led_min; i < led_max; i++) { | ||
10 | LED_MATRIX_TEST_LED_FLAGS(); | ||
11 | int16_t dx = g_led_config.point[i].x - k_led_matrix_center.x; | ||
12 | int16_t dy = g_led_config.point[i].y - k_led_matrix_center.y; | ||
13 | led_matrix_set_value(i, effect_func(led_matrix_eeconfig.val, dx, dy, time)); | ||
14 | } | ||
15 | return led_max < DRIVER_LED_TOTAL; | ||
16 | } | ||
diff --git a/quantum/led_matrix/animations/runners/effect_runner_dx_dy_dist.h b/quantum/led_matrix/animations/runners/effect_runner_dx_dy_dist.h new file mode 100644 index 000000000..5ef5938be --- /dev/null +++ b/quantum/led_matrix/animations/runners/effect_runner_dx_dy_dist.h | |||
@@ -0,0 +1,17 @@ | |||
1 | #pragma once | ||
2 | |||
3 | typedef uint8_t (*dx_dy_dist_f)(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uint8_t time); | ||
4 | |||
5 | bool effect_runner_dx_dy_dist(effect_params_t* params, dx_dy_dist_f effect_func) { | ||
6 | LED_MATRIX_USE_LIMITS(led_min, led_max); | ||
7 | |||
8 | uint8_t time = scale16by8(g_led_timer, led_matrix_eeconfig.speed / 2); | ||
9 | for (uint8_t i = led_min; i < led_max; i++) { | ||
10 | LED_MATRIX_TEST_LED_FLAGS(); | ||
11 | int16_t dx = g_led_config.point[i].x - k_led_matrix_center.x; | ||
12 | int16_t dy = g_led_config.point[i].y - k_led_matrix_center.y; | ||
13 | uint8_t dist = sqrt16(dx * dx + dy * dy); | ||
14 | led_matrix_set_value(i, effect_func(led_matrix_eeconfig.val, dx, dy, dist, time)); | ||
15 | } | ||
16 | return led_max < DRIVER_LED_TOTAL; | ||
17 | } | ||
diff --git a/quantum/led_matrix/animations/runners/effect_runner_i.h b/quantum/led_matrix/animations/runners/effect_runner_i.h new file mode 100644 index 000000000..b3015759b --- /dev/null +++ b/quantum/led_matrix/animations/runners/effect_runner_i.h | |||
@@ -0,0 +1,14 @@ | |||
1 | #pragma once | ||
2 | |||
3 | typedef uint8_t (*i_f)(uint8_t val, uint8_t i, uint8_t time); | ||
4 | |||
5 | bool effect_runner_i(effect_params_t* params, i_f effect_func) { | ||
6 | LED_MATRIX_USE_LIMITS(led_min, led_max); | ||
7 | |||
8 | uint8_t time = scale16by8(g_led_timer, led_matrix_eeconfig.speed / 4); | ||
9 | for (uint8_t i = led_min; i < led_max; i++) { | ||
10 | LED_MATRIX_TEST_LED_FLAGS(); | ||
11 | led_matrix_set_value(i, effect_func(led_matrix_eeconfig.val, i, time)); | ||
12 | } | ||
13 | return led_max < DRIVER_LED_TOTAL; | ||
14 | } | ||
diff --git a/quantum/led_matrix/animations/runners/effect_runner_reactive.h b/quantum/led_matrix/animations/runners/effect_runner_reactive.h new file mode 100644 index 000000000..4369ea8c4 --- /dev/null +++ b/quantum/led_matrix/animations/runners/effect_runner_reactive.h | |||
@@ -0,0 +1,28 @@ | |||
1 | #pragma once | ||
2 | |||
3 | #ifdef LED_MATRIX_KEYREACTIVE_ENABLED | ||
4 | |||
5 | typedef uint8_t (*reactive_f)(uint8_t val, uint16_t offset); | ||
6 | |||
7 | bool effect_runner_reactive(effect_params_t* params, reactive_f effect_func) { | ||
8 | LED_MATRIX_USE_LIMITS(led_min, led_max); | ||
9 | |||
10 | uint16_t max_tick = 65535 / led_matrix_eeconfig.speed; | ||
11 | for (uint8_t i = led_min; i < led_max; i++) { | ||
12 | LED_MATRIX_TEST_LED_FLAGS(); | ||
13 | uint16_t tick = max_tick; | ||
14 | // Reverse search to find most recent key hit | ||
15 | for (int8_t j = g_last_hit_tracker.count - 1; j >= 0; j--) { | ||
16 | if (g_last_hit_tracker.index[j] == i && g_last_hit_tracker.tick[j] < tick) { | ||
17 | tick = g_last_hit_tracker.tick[j]; | ||
18 | break; | ||
19 | } | ||
20 | } | ||
21 | |||
22 | uint16_t offset = scale16by8(tick, led_matrix_eeconfig.speed); | ||
23 | led_matrix_set_value(i, effect_func(led_matrix_eeconfig.val, offset)); | ||
24 | } | ||
25 | return led_max < DRIVER_LED_TOTAL; | ||
26 | } | ||
27 | |||
28 | #endif // LED_MATRIX_KEYREACTIVE_ENABLED | ||
diff --git a/quantum/led_matrix/animations/runners/effect_runner_reactive_splash.h b/quantum/led_matrix/animations/runners/effect_runner_reactive_splash.h new file mode 100644 index 000000000..d6eb9731e --- /dev/null +++ b/quantum/led_matrix/animations/runners/effect_runner_reactive_splash.h | |||
@@ -0,0 +1,26 @@ | |||
1 | #pragma once | ||
2 | |||
3 | #ifdef LED_MATRIX_KEYREACTIVE_ENABLED | ||
4 | |||
5 | typedef uint8_t (*reactive_splash_f)(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick); | ||
6 | |||
7 | bool effect_runner_reactive_splash(uint8_t start, effect_params_t* params, reactive_splash_f effect_func) { | ||
8 | LED_MATRIX_USE_LIMITS(led_min, led_max); | ||
9 | |||
10 | uint8_t count = g_last_hit_tracker.count; | ||
11 | for (uint8_t i = led_min; i < led_max; i++) { | ||
12 | LED_MATRIX_TEST_LED_FLAGS(); | ||
13 | uint8_t val = 0; | ||
14 | for (uint8_t j = start; j < count; j++) { | ||
15 | int16_t dx = g_led_config.point[i].x - g_last_hit_tracker.x[j]; | ||
16 | int16_t dy = g_led_config.point[i].y - g_last_hit_tracker.y[j]; | ||
17 | uint8_t dist = sqrt16(dx * dx + dy * dy); | ||
18 | uint16_t tick = scale16by8(g_last_hit_tracker.tick[j], led_matrix_eeconfig.speed); | ||
19 | val = effect_func(val, dx, dy, dist, tick); | ||
20 | } | ||
21 | led_matrix_set_value(i, scale8(val, led_matrix_eeconfig.val)); | ||
22 | } | ||
23 | return led_max < DRIVER_LED_TOTAL; | ||
24 | } | ||
25 | |||
26 | #endif // LED_MATRIX_KEYREACTIVE_ENABLED | ||
diff --git a/quantum/led_matrix/animations/runners/effect_runner_sin_cos_i.h b/quantum/led_matrix/animations/runners/effect_runner_sin_cos_i.h new file mode 100644 index 000000000..4a5219abd --- /dev/null +++ b/quantum/led_matrix/animations/runners/effect_runner_sin_cos_i.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #pragma once | ||
2 | |||
3 | typedef uint8_t (*sin_cos_i_f)(uint8_t val, int8_t sin, int8_t cos, uint8_t i, uint8_t time); | ||
4 | |||
5 | bool effect_runner_sin_cos_i(effect_params_t* params, sin_cos_i_f effect_func) { | ||
6 | LED_MATRIX_USE_LIMITS(led_min, led_max); | ||
7 | |||
8 | uint16_t time = scale16by8(g_led_timer, led_matrix_eeconfig.speed / 4); | ||
9 | int8_t cos_value = cos8(time) - 128; | ||
10 | int8_t sin_value = sin8(time) - 128; | ||
11 | for (uint8_t i = led_min; i < led_max; i++) { | ||
12 | LED_MATRIX_TEST_LED_FLAGS(); | ||
13 | led_matrix_set_value(i, effect_func(led_matrix_eeconfig.val, cos_value, sin_value, i, time)); | ||
14 | } | ||
15 | return led_max < DRIVER_LED_TOTAL; | ||
16 | } | ||
diff --git a/quantum/led_matrix/animations/runners/led_matrix_runners.inc b/quantum/led_matrix/animations/runners/led_matrix_runners.inc new file mode 100644 index 000000000..c09022bb0 --- /dev/null +++ b/quantum/led_matrix/animations/runners/led_matrix_runners.inc | |||
@@ -0,0 +1,6 @@ | |||
1 | #include "effect_runner_dx_dy_dist.h" | ||
2 | #include "effect_runner_dx_dy.h" | ||
3 | #include "effect_runner_i.h" | ||
4 | #include "effect_runner_sin_cos_i.h" | ||
5 | #include "effect_runner_reactive.h" | ||
6 | #include "effect_runner_reactive_splash.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..94425c959 --- /dev/null +++ b/quantum/led_matrix/animations/solid_reactive_cross.h | |||
@@ -0,0 +1,35 @@ | |||
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) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_CROSS_math); } | ||
27 | # endif | ||
28 | |||
29 | # ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS | ||
30 | bool SOLID_REACTIVE_MULTICROSS(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_CROSS_math); } | ||
31 | # endif | ||
32 | |||
33 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
34 | # endif // !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS) | ||
35 | #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..504b1104f --- /dev/null +++ b/quantum/led_matrix/animations/solid_reactive_nexus.h | |||
@@ -0,0 +1,32 @@ | |||
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) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_NEXUS_math); } | ||
24 | # endif | ||
25 | |||
26 | # ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS | ||
27 | bool SOLID_REACTIVE_MULTINEXUS(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_NEXUS_math); } | ||
28 | # endif | ||
29 | |||
30 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
31 | # endif // !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS) | ||
32 | #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..4752a8416 --- /dev/null +++ b/quantum/led_matrix/animations/solid_reactive_simple_anim.h | |||
@@ -0,0 +1,12 @@ | |||
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) { return scale8(255 - offset, val); } | ||
7 | |||
8 | bool SOLID_REACTIVE_SIMPLE(effect_params_t* params) { return effect_runner_reactive(params, &SOLID_REACTIVE_SIMPLE_math); } | ||
9 | |||
10 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
11 | # endif // DISABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE | ||
12 | #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..922e32fe5 --- /dev/null +++ b/quantum/led_matrix/animations/solid_reactive_wide.h | |||
@@ -0,0 +1,30 @@ | |||
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) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_WIDE_math); } | ||
22 | # endif | ||
23 | |||
24 | # ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE | ||
25 | bool SOLID_REACTIVE_MULTIWIDE(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_WIDE_math); } | ||
26 | # endif | ||
27 | |||
28 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
29 | # endif // !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE) | ||
30 | #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..d95889b81 --- /dev/null +++ b/quantum/led_matrix/animations/solid_splash_anim.h | |||
@@ -0,0 +1,30 @@ | |||
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) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_SPLASH_math); } | ||
22 | # endif | ||
23 | |||
24 | # ifndef DISABLE_LED_MATRIX_SOLID_MULTISPLASH | ||
25 | bool SOLID_MULTISPLASH(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_SPLASH_math); } | ||
26 | # endif | ||
27 | |||
28 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
29 | # endif // !defined(DISABLE_LED_MATRIX_SPLASH) && !defined(DISABLE_LED_MATRIX_MULTISPLASH) | ||
30 | #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..8579f1b45 --- /dev/null +++ b/quantum/led_matrix/animations/wave_left_right_anim.h | |||
@@ -0,0 +1,10 @@ | |||
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) { return scale8(sin8(g_led_config.point[i].x - time), val); } | ||
6 | |||
7 | bool WAVE_LEFT_RIGHT(effect_params_t* params) { return effect_runner_i(params, &WAVE_LEFT_RIGHT_math); } | ||
8 | |||
9 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
10 | #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..635c60841 --- /dev/null +++ b/quantum/led_matrix/animations/wave_up_down_anim.h | |||
@@ -0,0 +1,10 @@ | |||
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) { return scale8(sin8(g_led_config.point[i].y - time), val); } | ||
6 | |||
7 | bool WAVE_UP_DOWN(effect_params_t* params) { return effect_runner_i(params, &WAVE_UP_DOWN_math); } | ||
8 | |||
9 | # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS | ||
10 | #endif // DISABLE_LED_MATRIX_WAVE_UP_DOWN | ||