diff --git a/include/effect_confetti.h b/include/effect_confetti.h index 4009e73..cff7210 100644 --- a/include/effect_confetti.h +++ b/include/effect_confetti.h @@ -5,8 +5,16 @@ #include "my_fastled.h" class ConfettiEffect : public Effect { +protected: + virtual CRGB _getColor(); +public: void loop(); boolean can_be_shown_with_clock(); }; +class RandomConfettiEffect : public ConfettiEffect { +protected: + CRGB _getColor() override; +}; + #endif diff --git a/src/effect_confetti.cpp b/src/effect_confetti.cpp index 7c9128a..e48cebf 100644 --- a/src/effect_confetti.cpp +++ b/src/effect_confetti.cpp @@ -6,9 +6,17 @@ void ConfettiEffect::loop() { window->fadeToBlackBy(3); for (int i=0; iaddPixelColor(random16(LED_COUNT), &color); } } +CRGB ConfettiEffect::_getColor() { + return CHSV(baseHue + random8(64), 255, 255); +} + +CRGB RandomConfettiEffect::_getColor() { + return CHSV(random8(), 255, 255); +} + boolean ConfettiEffect::can_be_shown_with_clock() { return true; };