Added effects SingleDynamic and MultiDynamic.
This commit is contained in:
parent
659181b25c
commit
08ac5c891c
30
effects.h
30
effects.h
@ -266,3 +266,33 @@ class Animation : public Effect {
|
|||||||
return animation->delays[0];
|
return animation->delays[0];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class SingleDynamic : public Effect {
|
||||||
|
protected:
|
||||||
|
static const int factor = 2;
|
||||||
|
static const int tile_count = LED_WIDTH/factor * LED_HEIGHT/factor;
|
||||||
|
CRGB tiles[tile_count];
|
||||||
|
public:
|
||||||
|
SingleDynamic() {
|
||||||
|
for (int i=0; i<tile_count; i++) tiles[i] = CHSV(random8(), 120, 255);
|
||||||
|
}
|
||||||
|
virtual void update() {
|
||||||
|
tiles[random8() % tile_count] = CHSV(random8(), 120, 255);
|
||||||
|
}
|
||||||
|
boolean can_be_shown_with_clock() { return true; }
|
||||||
|
void loop() {
|
||||||
|
EVERY_N_MILLISECONDS(400) { update(); }
|
||||||
|
|
||||||
|
for (int x=0; x<window.w; x++) for (int y=0; y<window.h; y++) {
|
||||||
|
int index = y/2 * window.w/2 + x/2;
|
||||||
|
setPixel(window, x, y, tiles[index]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class MultiDynamic : public SingleDynamic {
|
||||||
|
public:
|
||||||
|
void update() {
|
||||||
|
for (int i=0; i<tile_count; i++) tiles[i] = CHSV(random8(), 120, 255);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
@ -34,7 +34,7 @@ typedef struct {
|
|||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
#include "effects.h"
|
#include "effects.h"
|
||||||
|
|
||||||
#define NUM_EFFECTS 7
|
#define NUM_EFFECTS 9
|
||||||
//EffectEntry effects[NUM_EFFECTS];
|
//EffectEntry effects[NUM_EFFECTS];
|
||||||
Sinematrix3 sinematrix3;
|
Sinematrix3 sinematrix3;
|
||||||
BigClock big_clock;
|
BigClock big_clock;
|
||||||
@ -43,6 +43,8 @@ Bell bell;
|
|||||||
Static off(CRGB(0x000000));
|
Static off(CRGB(0x000000));
|
||||||
Animation anim_koopa(&koopa, CRGB(0x000000), 0, 0);
|
Animation anim_koopa(&koopa, CRGB(0x000000), 0, 0);
|
||||||
Animation anim_couple_rain(&couple_rain, CRGB(0x000000), -8, -16);
|
Animation anim_couple_rain(&couple_rain, CRGB(0x000000), -8, -16);
|
||||||
|
SingleDynamic single_dynamic;
|
||||||
|
MultiDynamic multi_dynamic;
|
||||||
|
|
||||||
EffectEntry effects[NUM_EFFECTS] = {
|
EffectEntry effects[NUM_EFFECTS] = {
|
||||||
{"sinematrix3", (Effect *)&sinematrix3},
|
{"sinematrix3", (Effect *)&sinematrix3},
|
||||||
@ -51,7 +53,9 @@ EffectEntry effects[NUM_EFFECTS] = {
|
|||||||
{"bell", (Effect *)&bell},
|
{"bell", (Effect *)&bell},
|
||||||
{"off", (Effect *)&off},
|
{"off", (Effect *)&off},
|
||||||
{"koopa", (Effect *)&anim_koopa},
|
{"koopa", (Effect *)&anim_koopa},
|
||||||
{"couple_rain", (Effect *)&anim_couple_rain}
|
{"couple_rain", (Effect *)&anim_couple_rain},
|
||||||
|
{"single_dynamic", (Effect *)&single_dynamic},
|
||||||
|
{"multi_dynamic", (Effect *)&multi_dynamic}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user