MatrixEffect can now have multiple columns in the same column. In RandomMatrix, they even run in all directions.
This commit is contained in:
@ -9,16 +9,23 @@
|
||||
class MatrixEffectColumn {
|
||||
protected:
|
||||
Window* window;
|
||||
int x, y;
|
||||
int length = 1;
|
||||
uint8_t x, y;
|
||||
uint8_t length = 1;
|
||||
uint8_t _direction = 2;
|
||||
bool _random_direction = false;
|
||||
virtual CRGB _getColor(uint8_t height);
|
||||
virtual void restart();
|
||||
virtual void restart(bool completely_random);
|
||||
private:
|
||||
uint16_t speed;
|
||||
boolean running;
|
||||
unsigned long last_move = 0;
|
||||
public:
|
||||
MatrixEffectColumn(Window* win, int xPos);
|
||||
static const uint8_t DIR_NORTH = 0;
|
||||
static const uint8_t DIR_EAST = 1;
|
||||
static const uint8_t DIR_SOUTH = 2;
|
||||
static const uint8_t DIR_WEST = 3;
|
||||
|
||||
MatrixEffectColumn(Window* win, uint8_t direction=0, bool random_direction=false);
|
||||
virtual ~MatrixEffectColumn() {};
|
||||
void advance();
|
||||
void draw();
|
||||
@ -29,16 +36,16 @@ class RainbowMatrixEffectColumn : public MatrixEffectColumn {
|
||||
protected:
|
||||
CRGB _getColor(uint8_t height) override;
|
||||
public:
|
||||
RainbowMatrixEffectColumn(Window* win, int xPos) : MatrixEffectColumn(win, xPos) {};
|
||||
RainbowMatrixEffectColumn(Window* win, uint8_t dir, bool rnd=false) : MatrixEffectColumn(win, dir, rnd) {};
|
||||
};
|
||||
|
||||
class RandomMatrixEffectColumn : public MatrixEffectColumn {
|
||||
protected:
|
||||
uint8_t _hue = 42;
|
||||
CRGB _getColor(uint8_t height) override;
|
||||
void restart() override;
|
||||
void restart(bool completely_random) override;
|
||||
public:
|
||||
RandomMatrixEffectColumn(Window* win, int xPos) : MatrixEffectColumn(win, xPos) {};
|
||||
RandomMatrixEffectColumn(Window* win, uint8_t dir, bool rnd=false) : MatrixEffectColumn(win, dir, rnd) {};
|
||||
};
|
||||
|
||||
class MatrixEffect : public Effect {
|
||||
|
Reference in New Issue
Block a user