2019-06-16 10:43:05 +00:00
|
|
|
#pragma once
|
2019-05-29 22:49:54 +00:00
|
|
|
|
|
|
|
#include "prototypes.h"
|
|
|
|
#include "Effect.h"
|
|
|
|
#include "config.h"
|
|
|
|
#include "my_fastled.h"
|
2019-06-04 03:55:24 +00:00
|
|
|
#include "my_color_palettes.h"
|
2019-05-29 22:49:54 +00:00
|
|
|
|
|
|
|
class MatrixEffectColumn {
|
2019-06-16 10:43:05 +00:00
|
|
|
protected:
|
2019-05-29 22:49:54 +00:00
|
|
|
Window* window;
|
2019-06-16 10:43:05 +00:00
|
|
|
int x, y;
|
|
|
|
int length = 1;
|
|
|
|
virtual CRGB _getColor(uint8_t height);
|
2019-06-18 16:09:05 +00:00
|
|
|
virtual void restart();
|
2019-06-16 10:43:05 +00:00
|
|
|
private:
|
2019-05-30 09:26:13 +00:00
|
|
|
uint16_t speed;
|
2019-05-29 22:49:54 +00:00
|
|
|
boolean running;
|
2019-05-30 09:26:13 +00:00
|
|
|
unsigned long last_move = 0;
|
2019-06-07 04:24:16 +00:00
|
|
|
public:
|
2019-05-29 22:49:54 +00:00
|
|
|
MatrixEffectColumn(Window* win, int xPos);
|
2019-06-18 16:09:05 +00:00
|
|
|
virtual ~MatrixEffectColumn() {};
|
2019-05-29 22:49:54 +00:00
|
|
|
void advance();
|
|
|
|
void draw();
|
|
|
|
void loop();
|
|
|
|
};
|
|
|
|
|
2019-06-16 10:43:05 +00:00
|
|
|
class RainbowMatrixEffectColumn : public MatrixEffectColumn {
|
|
|
|
protected:
|
|
|
|
CRGB _getColor(uint8_t height) override;
|
|
|
|
public:
|
|
|
|
RainbowMatrixEffectColumn(Window* win, int xPos) : MatrixEffectColumn(win, xPos) {};
|
|
|
|
};
|
|
|
|
|
|
|
|
class RandomMatrixEffectColumn : public MatrixEffectColumn {
|
|
|
|
protected:
|
|
|
|
uint8_t _hue = 42;
|
|
|
|
CRGB _getColor(uint8_t height) override;
|
2019-06-18 16:09:05 +00:00
|
|
|
void restart() override;
|
2019-06-16 10:43:05 +00:00
|
|
|
public:
|
|
|
|
RandomMatrixEffectColumn(Window* win, int xPos) : MatrixEffectColumn(win, xPos) {};
|
|
|
|
};
|
|
|
|
|
2019-05-29 22:49:54 +00:00
|
|
|
class MatrixEffect : public Effect {
|
2019-06-16 10:43:05 +00:00
|
|
|
protected:
|
|
|
|
MatrixEffectColumn** _columns;
|
2019-06-18 16:09:05 +00:00
|
|
|
virtual void _init();
|
2019-06-07 04:24:16 +00:00
|
|
|
public:
|
2019-05-29 22:49:54 +00:00
|
|
|
boolean can_be_shown_with_clock();
|
|
|
|
MatrixEffect();
|
2019-06-18 16:09:05 +00:00
|
|
|
virtual ~MatrixEffect();
|
2019-05-29 22:49:54 +00:00
|
|
|
void loop();
|
|
|
|
};
|
|
|
|
|
2019-06-16 10:43:05 +00:00
|
|
|
class RainbowMatrixEffect : public MatrixEffect {
|
2019-06-18 16:09:05 +00:00
|
|
|
private:
|
|
|
|
void _init() override;
|
2019-06-16 10:43:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class RandomMatrixEffect : public MatrixEffect {
|
2019-06-18 16:09:05 +00:00
|
|
|
private:
|
|
|
|
void _init() override;
|
2019-06-16 10:43:05 +00:00
|
|
|
};
|