diff --git a/include/effects.h b/include/effects.h index 24b9f55..1aae3b2 100644 --- a/include/effects.h +++ b/include/effects.h @@ -4,6 +4,8 @@ #include "effects/clock.h" #include "effects/timer.h" +#define SIMPLE_EFFECT [](accum88 t, uint16_t i, uint8_t x, uint8_t y)->int8_t + struct EffectEntry { const char* name; bool use_in_cycle; diff --git a/src/effects.cpp b/src/effects.cpp index cd959ca..658b3cd 100644 --- a/src/effects.cpp +++ b/src/effects.cpp @@ -48,8 +48,8 @@ EffectEntry effects[] = { /* 10 */ {"rainbow_matrix", true, [](){ return new RainbowMatrixEffect(); }}, /* 11 */ {"cycle", 0, [](){ return new CycleEffect(); }}, /* 12 */ {"twirl", true, [](){ return new TwirlEffect(); }}, - /* 13 */ {"confetti", true, [](){ return (new SimpleEffect("confetti", [](accum88 t, uint16_t i, uint8_t x, uint8_t y)->int8_t{return random8()>252 ? 127 : 0;}))->with_fadeout();}}, - /* 14 */ {"rainbow_confetti", true, [](){ return (new SimpleEffect("rainbow_confetti", [](accum88 t, uint16_t i, uint8_t x, uint8_t y)->int8_t{return random8()>252 ? 127 : 0;}))->with_fadeout()->with_random_colors();}}, + /* 13 */ {"confetti", true, [](){ return (new SimpleEffect("confetti", SIMPLE_EFFECT{return random8()>252 ? 127 : 0;}))->with_fadeout();}}, + /* 14 */ {"rainbow_confetti", true, [](){ return (new SimpleEffect("rainbow_confetti", SIMPLE_EFFECT{return random8()>252 ? 127 : 0;}))->with_fadeout()->with_random_colors();}}, /* 15 */ {"snake", true, [](){ return new SnakeEffect(); }}, /* 16 */ {"firework", true, [](){ return new FireworkEffect(); }}, /* 17 */ {"gol", true, [](){ return new GolEffect(); }}, @@ -69,9 +69,11 @@ EffectEntry effects[] = { /* 31 */ {"child", 0, [](){ return AnimationEffect::Blinker("/child.pia", 300, 0xFFFF00); }}, /* 32 */ {"diamond", true, [](){ return new DiamondEffect(); }}, /* 33 */ {"tpm2.net", 0, [](){ return new Tpm2NetEffect(); }}, - /* 34 */ {"slow_blinking", true, [](){ return new SimpleEffect("slow_blinking", [](accum88 t, uint16_t i, uint8_t x, uint8_t y)->int8_t{return sin8((t>>3) + ((((x+1)*(y+1)*i*15) >> 2) & 0xFF))-128;});}}, + /* 34 */ {"slow_blinking", true, [](){ return new SimpleEffect("slow_blinking", SIMPLE_EFFECT{return sin8((t>>3) + ((((x+1)*(y+1)*i*15) >> 2) & 0xFF))-128;});}}, + /* 35 */ {"upwave", true, [](){ return new SimpleEffect("upwave", SIMPLE_EFFECT{return abs(cos8((t>>3)+(y<<4))-128);});}}, + /* 36 */ {"centerwave", true, [](){ return new SimpleEffect("centerwave", SIMPLE_EFFECT{return sin8((t>>1) - sqrt((x-4)*(x-4) + (y-7)*(y-7))*32)-128;});}}, }; -const uint8_t effects_size = 35; +const uint8_t effects_size = 37; Effect* select_effect(const char* name) {