Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Riverflow matrix effect with runner #24520

Merged
merged 2 commits into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions quantum/rgb_matrix/animations/riverflow_anim.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down