water ripple effect with a dimmed rainbow background
This commit is contained in:
parent
a004d1647d
commit
d0b9f53d8c
@ -2133,7 +2133,7 @@ typedef struct Ripple {
|
||||
uint16_t pos;
|
||||
} ripple;
|
||||
|
||||
uint16_t WS2812FX::mode_ripple()
|
||||
uint16_t WS2812FX::ripple_base(bool rainbow)
|
||||
{
|
||||
uint16_t maxRipples = 1 + (SEGLEN >> 2);
|
||||
if (maxRipples > 100) maxRipples = 100;
|
||||
@ -2143,8 +2143,25 @@ uint16_t WS2812FX::mode_ripple()
|
||||
|
||||
Ripple* ripples = reinterpret_cast<Ripple*>(SEGENV.data);
|
||||
|
||||
fill(SEGCOLOR(1));
|
||||
|
||||
// ranbow background or chosen background, all very dim.
|
||||
if (rainbow) {
|
||||
if (SEGENV.call ==0) {
|
||||
SEGENV.aux0 = random8();
|
||||
SEGENV.aux1 = random8();
|
||||
}
|
||||
if (SEGENV.aux0 == SEGENV.aux1) {
|
||||
SEGENV.aux1 = random8();
|
||||
}
|
||||
else if (SEGENV.aux1 > SEGENV.aux0) {
|
||||
SEGENV.aux0++;
|
||||
} else {
|
||||
SEGENV.aux0--;
|
||||
}
|
||||
fill(color_blend(color_wheel(SEGENV.aux0),BLACK,235));
|
||||
} else {
|
||||
fill(SEGCOLOR(1));
|
||||
}
|
||||
|
||||
//draw wave
|
||||
for (uint16_t i = 0; i < maxRipples; i++)
|
||||
{
|
||||
@ -2188,6 +2205,15 @@ uint16_t WS2812FX::mode_ripple()
|
||||
return FRAMETIME;
|
||||
}
|
||||
|
||||
uint16_t WS2812FX::mode_ripple(void) {
|
||||
return ripple_base(false);
|
||||
}
|
||||
|
||||
uint16_t WS2812FX::mode_ripple_rainbow(void) {
|
||||
return ripple_base(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// TwinkleFOX by Mark Kriegsman: https://gist.github.com/kriegsman/756ea6dcae8e30845b5a
|
||||
//
|
||||
|
10
wled00/FX.h
10
wled00/FX.h
@ -91,7 +91,7 @@
|
||||
#define IS_REVERSE ((SEGMENT.options & REVERSE ) == REVERSE )
|
||||
#define IS_SELECTED ((SEGMENT.options & SELECTED) == SELECTED )
|
||||
|
||||
#define MODE_COUNT 99
|
||||
#define MODE_COUNT 100
|
||||
|
||||
#define FX_MODE_STATIC 0
|
||||
#define FX_MODE_BLINK 1
|
||||
@ -192,6 +192,7 @@
|
||||
#define FX_MODE_DRIP 96
|
||||
#define FX_MODE_PLASMA 97
|
||||
#define FX_MODE_PERCENT 98
|
||||
#define FX_MODE_RIPPLE_RAINBOW 99
|
||||
|
||||
class WS2812FX {
|
||||
typedef uint16_t (WS2812FX::*mode_ptr)(void);
|
||||
@ -379,6 +380,7 @@ class WS2812FX {
|
||||
_mode[FX_MODE_DRIP] = &WS2812FX::mode_drip;
|
||||
_mode[FX_MODE_PLASMA] = &WS2812FX::mode_plasma;
|
||||
_mode[FX_MODE_PERCENT] = &WS2812FX::mode_percent;
|
||||
_mode[FX_MODE_RIPPLE_RAINBOW] = &WS2812FX::mode_ripple_rainbow;
|
||||
|
||||
_brightness = DEFAULT_BRIGHTNESS;
|
||||
currentPalette = CRGBPalette16(CRGB::Black);
|
||||
@ -562,7 +564,8 @@ class WS2812FX {
|
||||
mode_popcorn(void),
|
||||
mode_drip(void),
|
||||
mode_plasma(void),
|
||||
mode_percent(void);
|
||||
mode_percent(void),
|
||||
mode_ripple_rainbow(void);
|
||||
|
||||
|
||||
private:
|
||||
@ -607,6 +610,7 @@ class WS2812FX {
|
||||
dissolve(uint32_t),
|
||||
chase(uint32_t, uint32_t, uint32_t, bool),
|
||||
gradient_base(bool),
|
||||
ripple_base(bool),
|
||||
police_base(uint32_t, uint32_t),
|
||||
running(uint32_t, uint32_t),
|
||||
tricolor_chase(uint32_t, uint32_t),
|
||||
@ -642,7 +646,7 @@ const char JSON_mode_names[] PROGMEM = R"=====([
|
||||
"Scanner Dual","Stream 2","Oscillate","Pride 2015","Juggle","Palette","Fire 2012","Colorwaves","Bpm","Fill Noise",
|
||||
"Noise 1","Noise 2","Noise 3","Noise 4","Colortwinkles","Lake","Meteor","Meteor Smooth","Railway","Ripple",
|
||||
"Twinklefox","Twinklecat","Halloween Eyes","Solid Pattern","Solid Pattern Tri","Spots","Spots Fade","Glitter","Candle","Fireworks Starburst",
|
||||
"Fireworks 1D","Bouncing Balls","Sinelon","Sinelon Dual","Sinelon Rainbow","Popcorn","Drip","Plasma","Percent"
|
||||
"Fireworks 1D","Bouncing Balls","Sinelon","Sinelon Dual","Sinelon Rainbow","Popcorn","Drip","Plasma","Percent", "Ripple Rainbow"
|
||||
])=====";
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user