From 87cc3fd714fe7c5a3dd806f8dbd529493f171d9d Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Sat, 16 Sep 2023 00:21:10 +0200 Subject: [PATCH] 2D Ripple effect tweak for #3370 --- wled00/FX.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 9fed2779..88de1d14 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -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";