diff options
Diffstat (limited to 'quantum/led_matrix/animations/solid_reactive_cross.h')
-rw-r--r-- | quantum/led_matrix/animations/solid_reactive_cross.h | 35 |
1 files changed, 35 insertions, 0 deletions
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 | ||