rgb_matrix_user.inc 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. QMK Firmware Massdrop CTRL M-AS Keymap
  3. Copyright (C) 2020 matthewrobo
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. // !!! DO NOT ADD #pragma once !!! //
  16. // Step 1.
  17. // Declare custom effects using the RGB_MATRIX_EFFECT macro
  18. // (note the lack of semicolon after the macro!)
  19. RGB_MATRIX_EFFECT(SOLID_REACTIVE_WIDE2)
  20. RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTIWIDE2)
  21. RGB_MATRIX_EFFECT(SOLID_REACTIVE_NEXUS2)
  22. RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTINEXUS2)
  23. // Step 2.
  24. // Define effects inside the `RGB_MATRIX_CUSTOM_EFFECT_IMPLS` ifdef block
  25. #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
  26. static HSV SOLID_REACTIVE_WIDE_math2(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
  27. uint16_t effect = tick - dist > 255 || dist > 32 ? 255 : tick - dist;
  28. hsv.v = qadd8(hsv.v, 255 - effect);
  29. return hsv;
  30. }
  31. static HSV SOLID_REACTIVE_NEXUS_math2(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
  32. uint16_t effect = tick - dist > 255 || ((dx > 8 || dx < -8) && (dy > 8 || dy < -8)) ? 255 : tick - dist;
  33. hsv.v = qadd8(hsv.v, 255 - effect);
  34. hsv.h = rgb_matrix_config.hsv.h + dy / 4;
  35. return hsv;
  36. }
  37. bool SOLID_REACTIVE_WIDE2(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_WIDE_math2); }
  38. bool SOLID_REACTIVE_MULTIWIDE2(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_WIDE_math2); }
  39. bool SOLID_REACTIVE_NEXUS2(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_NEXUS_math2); }
  40. bool SOLID_REACTIVE_MULTINEXUS2(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_NEXUS_math2); }
  41. #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS