summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
authorAlbert Y <76888457+filterpaper@users.noreply.github.com>2022-07-14 19:22:53 +0800
committerGitHub <noreply@github.com>2022-07-14 12:22:53 +0100
commit300dab7962ba50dcb4c550c91097573fa09b8dea (patch)
tree6c4be65a04d5a7fd995be1562b4b94d4fd711f4a /quantum
parent3c58f989295e17d03b66db9a154e02cde7336ece (diff)
[Code] Add solid reactive gradient mode (#17228)
Diffstat (limited to 'quantum')
-rw-r--r--quantum/rgb_matrix/animations/solid_reactive_anim.h3
-rw-r--r--quantum/rgb_matrix/animations/solid_reactive_cross.h3
-rw-r--r--quantum/rgb_matrix/animations/solid_reactive_nexus.h3
-rw-r--r--quantum/rgb_matrix/animations/solid_reactive_simple_anim.h3
-rw-r--r--quantum/rgb_matrix/animations/solid_reactive_wide.h3
5 files changed, 15 insertions, 0 deletions
diff --git a/quantum/rgb_matrix/animations/solid_reactive_anim.h b/quantum/rgb_matrix/animations/solid_reactive_anim.h
index d3a7ebbdf7..052bfb22fd 100644
--- a/quantum/rgb_matrix/animations/solid_reactive_anim.h
+++ b/quantum/rgb_matrix/animations/solid_reactive_anim.h
@@ -4,6 +4,9 @@ RGB_MATRIX_EFFECT(SOLID_REACTIVE)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
static HSV SOLID_REACTIVE_math(HSV hsv, uint16_t offset) {
+# ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE
+ hsv.h = scale16by8(g_rgb_timer, add8(rgb_matrix_config.speed, 1) >> 6);
+# endif
hsv.h += qsub8(130, offset);
return hsv;
}
diff --git a/quantum/rgb_matrix/animations/solid_reactive_cross.h b/quantum/rgb_matrix/animations/solid_reactive_cross.h
index 043a369b73..9e5703a0ea 100644
--- a/quantum/rgb_matrix/animations/solid_reactive_cross.h
+++ b/quantum/rgb_matrix/animations/solid_reactive_cross.h
@@ -19,6 +19,9 @@ static HSV SOLID_REACTIVE_CROSS_math(HSV hsv, int16_t dx, int16_t dy, uint8_t di
dy = dy * 16 > 255 ? 255 : dy * 16;
effect += dx > dy ? dy : dx;
if (effect > 255) effect = 255;
+# ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE
+ hsv.h = scale16by8(g_rgb_timer, add8(rgb_matrix_config.speed, 1) >> 6);
+# endif
hsv.v = qadd8(hsv.v, 255 - effect);
return hsv;
}
diff --git a/quantum/rgb_matrix/animations/solid_reactive_nexus.h b/quantum/rgb_matrix/animations/solid_reactive_nexus.h
index 8d62a49fea..64f5064cf9 100644
--- a/quantum/rgb_matrix/animations/solid_reactive_nexus.h
+++ b/quantum/rgb_matrix/animations/solid_reactive_nexus.h
@@ -16,6 +16,9 @@ static HSV SOLID_REACTIVE_NEXUS_math(HSV hsv, int16_t dx, int16_t dy, uint8_t di
if (effect > 255) effect = 255;
if (dist > 72) effect = 255;
if ((dx > 8 || dx < -8) && (dy > 8 || dy < -8)) effect = 255;
+# ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE
+ hsv.h = scale16by8(g_rgb_timer, add8(rgb_matrix_config.speed, 1) >> 6);
+# endif
hsv.v = qadd8(hsv.v, 255 - effect);
hsv.h = rgb_matrix_config.hsv.h + dy / 4;
return hsv;
diff --git a/quantum/rgb_matrix/animations/solid_reactive_simple_anim.h b/quantum/rgb_matrix/animations/solid_reactive_simple_anim.h
index 0d0a424cf3..bd3ce0817d 100644
--- a/quantum/rgb_matrix/animations/solid_reactive_simple_anim.h
+++ b/quantum/rgb_matrix/animations/solid_reactive_simple_anim.h
@@ -4,6 +4,9 @@ RGB_MATRIX_EFFECT(SOLID_REACTIVE_SIMPLE)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
static HSV SOLID_REACTIVE_SIMPLE_math(HSV hsv, uint16_t offset) {
+# ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE
+ hsv.h = scale16by8(g_rgb_timer, add8(rgb_matrix_config.speed, 1) >> 6);
+# endif
hsv.v = scale8(255 - offset, hsv.v);
return hsv;
}
diff --git a/quantum/rgb_matrix/animations/solid_reactive_wide.h b/quantum/rgb_matrix/animations/solid_reactive_wide.h
index 7598796316..24fedc2020 100644
--- a/quantum/rgb_matrix/animations/solid_reactive_wide.h
+++ b/quantum/rgb_matrix/animations/solid_reactive_wide.h
@@ -14,6 +14,9 @@ RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTIWIDE)
static HSV SOLID_REACTIVE_WIDE_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
uint16_t effect = tick + dist * 5;
if (effect > 255) effect = 255;
+# ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE
+ hsv.h = scale16by8(g_rgb_timer, add8(rgb_matrix_config.speed, 1) >> 6);
+# endif
hsv.v = qadd8(hsv.v, 255 - effect);
return hsv;
}