mirror of
https://github.com/qmk/qmk_firmware
synced 2024-12-22 08:26:21 +00:00
Refactor Riverflow matrix effect with runner (#24520)
Co-authored-by: Ryan <fauxpark@gmail.com>
This commit is contained in:
parent
f5b495e06e
commit
644588baef
@ -4,18 +4,14 @@ RGB_MATRIX_EFFECT(RIVERFLOW)
|
||||
|
||||
// inspired by @PleasureTek's Massdrop Alt LED animation
|
||||
|
||||
bool RIVERFLOW(effect_params_t* params) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
RGB_MATRIX_TEST_LED_FLAGS();
|
||||
hsv_t hsv = rgb_matrix_config.hsv;
|
||||
uint16_t time = scale16by8(g_rgb_timer + (i * 315), rgb_matrix_config.speed / 8);
|
||||
hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v);
|
||||
rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
hsv_t RIVERFLOW_math(hsv_t hsv, uint8_t i, uint8_t time) {
|
||||
time = scale16by8(g_rgb_timer + (i * 315), rgb_matrix_config.speed / 8);
|
||||
hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v);
|
||||
return hsv;
|
||||
}
|
||||
|
||||
return rgb_matrix_check_finished_leds(led_max);
|
||||
bool RIVERFLOW(effect_params_t* params) {
|
||||
return effect_runner_i(params, &RIVERFLOW_math);
|
||||
}
|
||||
|
||||
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
Loading…
x
Reference in New Issue
Block a user