Fork of the espurna firmware for `mhsw` switches
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.

41 lines
1.1 KiB

  1. #if GARLAND_SUPPORT
  2. #include "../anim.h"
  3. //------------------------------------------------------------------------------
  4. class AnimStart : public Anim {
  5. public:
  6. AnimStart() : Anim("Start") {
  7. }
  8. void SetupImpl() override {
  9. phase = 0;
  10. }
  11. void Run() override {
  12. if (phase < numLeds) {
  13. leds[phase].r = 255;
  14. leds[phase].g = 255;
  15. leds[phase].b = 255;
  16. for (int i = 0; i < numLeds; i++) {
  17. leds[i].fade(50);
  18. }
  19. } else if (phase >= numLeds) {
  20. for (int i = 0; i < numLeds; i++) {
  21. short r = numLeds + 255 - phase + rngb();
  22. r = min(r, (short)255);
  23. leds[i].r = (byte)max(r, (short)0);
  24. short g = numLeds + 255 - phase + rngb();
  25. g = min(g, (short)255);
  26. leds[i].g = (byte)max(g, (short)0);
  27. short b = numLeds + 255 - phase + rngb();
  28. b = min(b, (short)255);
  29. leds[i].b = (byte)max(b, (short)0);
  30. }
  31. phase++;
  32. }
  33. phase++;
  34. }
  35. };
  36. #endif // GARLAND_SUPPORT