You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
817 B

  1. #ifndef DISABLE_RGB_MATRIX_CYCLE_SPIRAL
  2. RGB_MATRIX_EFFECT(CYCLE_SPIRAL)
  3. #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
  4. bool CYCLE_SPIRAL(effect_params_t* params) {
  5. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  6. HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
  7. uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 2);
  8. for (uint8_t i = led_min; i < led_max; i++) {
  9. RGB_MATRIX_TEST_LED_FLAGS();
  10. int16_t dx = g_led_config.point[i].x - 112;
  11. int16_t dy = g_led_config.point[i].y - 32;
  12. uint8_t dist = sqrt16(dx * dx + dy * dy);
  13. hsv.h = dist - time - atan2_8(dy, dx);
  14. RGB rgb = hsv_to_rgb(hsv);
  15. rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
  16. }
  17. return led_max < DRIVER_LED_TOTAL;
  18. }
  19. #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
  20. #endif // DISABLE_RGB_MATRIX_CYCLE_SPIRAL