diff --git a/README.md b/README.md index dece8113..debffaa6 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,10 @@ The plugin provides the following effects: > A blazing trail of fire will follow our fingers! +### `Rainbow()` + +> Leave a rainbow behind, where your fingers has been! + ## Dependencies * [Kaleidoscope-LEDControl](https://github.com/keyboardio/Kaleidoscope-LEDControl) diff --git a/src/Kaleidoscope/LED-Stalker.cpp b/src/Kaleidoscope/LED-Stalker.cpp index 42c043d4..050fd28c 100644 --- a/src/Kaleidoscope/LED-Stalker.cpp +++ b/src/Kaleidoscope/LED-Stalker.cpp @@ -127,6 +127,19 @@ cRGB BlazingTrail::compute(uint8_t *step) { return color; } +// Rainbow +Rainbow::Rainbow(void) { +} + +cRGB Rainbow::compute(uint8_t *step) { + if (*step > 0) + *step -= 1; + else + *step = 0; + + return hsvToRgb(255 - *step, 255, *step); +} + } } diff --git a/src/Kaleidoscope/LED-Stalker.h b/src/Kaleidoscope/LED-Stalker.h index 99caed29..6cf9b464 100644 --- a/src/Kaleidoscope/LED-Stalker.h +++ b/src/Kaleidoscope/LED-Stalker.h @@ -67,6 +67,13 @@ class BlazingTrail : public StalkerEffect::ColorComputer { cRGB compute(uint8_t *step) final; }; +class Rainbow : public StalkerEffect::ColorComputer { + public: + Rainbow(void); + + cRGB compute(uint8_t *step) final; +}; + } }