Added new effect type SimpleEffect for, well, simple effects. Added new effect slow_blinking based on this and also converted the confetti effects.
This commit is contained in:
23
include/SimpleEffect.h
Normal file
23
include/SimpleEffect.h
Normal file
@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
#include "Effect.h"
|
||||
#include "prototypes.h"
|
||||
|
||||
class SimpleEffect : public Effect {
|
||||
protected:
|
||||
Window* window = &Window::window_full; // Use a full screen window per default.
|
||||
boolean _fade_out = false;
|
||||
boolean _random_colors = false;
|
||||
boolean _cycle_color = true;
|
||||
uint8_t _color = 0;
|
||||
String _name;
|
||||
simple_effect_t _method;
|
||||
public:
|
||||
SimpleEffect(String name, simple_effect_t method): _name { name }, _method { method } {};
|
||||
SimpleEffect* with_fadeout() { _fade_out=true; return this;}
|
||||
SimpleEffect* with_random_colors() { _random_colors=true; return this;}
|
||||
SimpleEffect* with_static_color(uint8_t color) { _cycle_color=false; _color=color; return this; }
|
||||
void loop(uint16_t ms) override;
|
||||
String get_name() { return _name; };
|
||||
boolean can_be_shown_with_clock() { return true; }
|
||||
|
||||
};
|
@ -1,20 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Effect.h"
|
||||
#include "my_fastled.h"
|
||||
|
||||
class ConfettiEffect : public Effect {
|
||||
protected:
|
||||
virtual CRGB _getColor();
|
||||
public:
|
||||
void loop(uint16_t ms);
|
||||
boolean can_be_shown_with_clock();
|
||||
String get_name() override { return "confetti"; }
|
||||
};
|
||||
|
||||
class RandomConfettiEffect : public ConfettiEffect {
|
||||
protected:
|
||||
CRGB _getColor() override;
|
||||
String get_name() override { return "random_confetti"; }
|
||||
};
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "my_fastled.h"
|
||||
|
||||
extern uint8_t baseHue;
|
||||
extern char hostname[30];
|
||||
@ -31,3 +32,5 @@ typedef struct {
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
} Coords;
|
||||
|
||||
typedef std::function<int8_t(accum88, uint16_t, uint8_t, uint8_t)> simple_effect_t;
|
Reference in New Issue
Block a user