Merge pull request #3373 from Aircoookie/ripple-tweak

2D Ripple and Meteor effect tweak
This commit is contained in:
Frank 2023-09-17 18:48:43 +02:00 committed by GitHub
commit 527e3d6cd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 998 additions and 997 deletions

View File

@ -2270,7 +2270,7 @@ uint16_t mode_meteor() {
{
byte meteorTrailDecay = 128 + random8(127);
trail[i] = scale8(trail[i], meteorTrailDecay);
SEGMENT.setPixelColor(i, SEGMENT.color_from_palette(i, true, false, 0, trail[i]));
SEGMENT.setPixelColor(i, color_blend(SEGCOLOR(1), SEGMENT.color_from_palette(i, true, false, 0), trail[i]));
}
}
@ -2281,12 +2281,12 @@ uint16_t mode_meteor() {
index -= SEGLEN;
}
trail[index] = 240;
SEGMENT.setPixelColor(index, SEGMENT.color_from_palette(index, true, false, 0, 255));
SEGMENT.setPixelColor(index, SEGMENT.color_from_palette(index, true, false, 0));
}
return FRAMETIME;
}
static const char _data_FX_MODE_METEOR[] PROGMEM = "Meteor@!,Trail length;!;!";
static const char _data_FX_MODE_METEOR[] PROGMEM = "Meteor@!,Trail length;!,!;!;1";
// smooth meteor effect
@ -2309,7 +2309,7 @@ uint16_t mode_meteor_smooth() {
trail[i] += change;
if (trail[i] > 245) trail[i] = 0;
if (trail[i] > 240) trail[i] = 240;
SEGMENT.setPixelColor(i, SEGMENT.color_from_palette(i, true, false, 0, trail[i]));
SEGMENT.setPixelColor(i, color_blend(SEGCOLOR(1), SEGMENT.color_from_palette(i, true, false, 0), trail[i]));
}
}
@ -2320,13 +2320,13 @@ uint16_t mode_meteor_smooth() {
index -= SEGLEN;
}
trail[index] = 240;
SEGMENT.setPixelColor(index, SEGMENT.color_from_palette(index, true, false, 0, 255));
SEGMENT.setPixelColor(index, SEGMENT.color_from_palette(index, true, false, 0));
}
SEGENV.step += SEGMENT.speed +1;
return FRAMETIME;
}
static const char _data_FX_MODE_METEOR_SMOOTH[] PROGMEM = "Meteor Smooth@!,Trail length;!;!";
static const char _data_FX_MODE_METEOR_SMOOTH[] PROGMEM = "Meteor Smooth@!,Trail length;!,!;!;1";
//Railway Crossing / Christmas Fairy lights
@ -2400,9 +2400,10 @@ uint16_t ripple_base()
#ifndef WLED_DISABLE_2D
if (SEGMENT.is2D()) {
propI /= 2;
uint16_t cx = rippleorigin >> 8;
uint16_t cy = rippleorigin & 0xFF;
uint8_t mag = scale8(cubicwave8((propF>>2)), amp);
uint8_t mag = scale8(sin8((propF>>2)), amp);
if (propI > 0) SEGMENT.draw_circle(cx, cy, propI, color_blend(SEGMENT.getPixelColorXY(cx + propI, cy), col, mag));
} else
#endif
@ -2418,7 +2419,7 @@ uint16_t ripple_base()
ripplestate += rippledecay;
ripples[i].state = (ripplestate > 254) ? 0 : ripplestate;
} else {//randomly create new wave
if (random16(IBN + 10000) <= SEGMENT.intensity) {
if (random16(IBN + 10000) <= (SEGMENT.intensity >> (SEGMENT.is2D()*3))) {
ripples[i].state = 1;
ripples[i].pos = SEGMENT.is2D() ? ((random8(SEGENV.virtualWidth())<<8) | (random8(SEGENV.virtualHeight()))) : random16(SEGLEN);
ripples[i].color = random8(); //color
@ -2434,6 +2435,7 @@ uint16_t ripple_base()
uint16_t mode_ripple(void) {
if (SEGLEN == 1) return mode_static();
if (!SEGMENT.check2) SEGMENT.fill(SEGCOLOR(1));
else SEGMENT.fade_out(250);
return ripple_base();
}
static const char _data_FX_MODE_RIPPLE[] PROGMEM = "Ripple@!,Wave #,,,,,Overlay;,!;!;12";

View File

@ -1248,7 +1248,7 @@ function updateSelectedPalette(s)
if (s > 1 && s < 6) {
cd[0].classList.remove('hide'); // * Color 1
if (s > 2) cd[1].classList.remove('hide'); // * Color 1 & 2
if (s == 5) cd[2].classList.remove('hide'); // all colors
if (s > 3) cd[2].classList.remove('hide'); // all colors
} else {
for (let i of cd) if (i.dataset.hide == '1') i.classList.add('hide');
}

File diff suppressed because it is too large Load Diff