2020-11-04 04:58:00 +00:00
|
|
|
#pragma once
|
|
|
|
#include "Effect.h"
|
|
|
|
#include "prototypes.h"
|
2020-11-06 22:33:37 +00:00
|
|
|
#include <cmath>
|
|
|
|
|
|
|
|
#define SE_CYCLE_COLORS 1 // Slowly cycle through the rainbow.
|
|
|
|
#define SE_RANDOM_PIXEL_COLORS 2 // Every pixel gets a random color every frame.
|
|
|
|
#define SE_ONLY_POSITIVE 4 // Only use colors, not white. This is equivalent to running your output through abs()
|
|
|
|
#define SE_FADEOUT 8 // Fades the old image out. Returning 0 doesn't change the pixel's value.
|
|
|
|
#define SE_RANDOM_STATIC_COLOR 16 // Sets a random static color at start of the effect.
|
|
|
|
#define SE_DEBUG 32 // Prints debug messages.
|
2020-11-04 04:58:00 +00:00
|
|
|
|
|
|
|
class SimpleEffect : public Effect {
|
|
|
|
protected:
|
|
|
|
Window* window = &Window::window_full; // Use a full screen window per default.
|
|
|
|
uint8_t _color = 0;
|
2020-11-06 22:33:37 +00:00
|
|
|
uint16_t _flags;
|
2020-11-04 04:58:00 +00:00
|
|
|
String _name;
|
|
|
|
simple_effect_t _method;
|
|
|
|
public:
|
2020-11-06 22:33:37 +00:00
|
|
|
SimpleEffect(String name, uint16_t flags, simple_effect_t method): _name { name }, _method { method } {
|
|
|
|
_flags = flags;
|
|
|
|
if (_flags & SE_RANDOM_STATIC_COLOR) {
|
|
|
|
_color = random8();
|
|
|
|
_flags &= ~SE_CYCLE_COLORS & ~SE_RANDOM_PIXEL_COLORS;
|
|
|
|
}
|
|
|
|
};
|
2020-11-04 04:58:00 +00:00
|
|
|
void loop(uint16_t ms) override;
|
|
|
|
String get_name() { return _name; };
|
|
|
|
boolean can_be_shown_with_clock() { return true; }
|
|
|
|
|
|
|
|
};
|