mirror of
https://github.com/wled/WLED.git
synced 2025-07-19 16:56:35 +00:00
Push variants
This commit is contained in:
parent
1975c9c34a
commit
c03422ee37
26
wled00/FX.h
26
wled00/FX.h
@ -325,18 +325,22 @@
|
||||
#define BLEND_STYLE_FAIRY_DUST 1
|
||||
#define BLEND_STYLE_SWIPE_RIGHT 2
|
||||
#define BLEND_STYLE_SWIPE_LEFT 3
|
||||
#define BLEND_STYLE_PINCH_OUT 4
|
||||
#define BLEND_STYLE_INSIDE_OUT 5
|
||||
#define BLEND_STYLE_SWIPE_UP 6
|
||||
#define BLEND_STYLE_SWIPE_DOWN 7
|
||||
#define BLEND_STYLE_OPEN_H 8
|
||||
#define BLEND_STYLE_OPEN_V 9
|
||||
#define BLEND_STYLE_PUSH_TL 10
|
||||
#define BLEND_STYLE_PUSH_TR 11
|
||||
#define BLEND_STYLE_PUSH_BR 12
|
||||
#define BLEND_STYLE_PUSH_BL 13
|
||||
#define BLEND_STYLE_PUSH_RIGHT 4
|
||||
#define BLEND_STYLE_PUSH_LEFT 5
|
||||
#define BLEND_STYLE_PINCH_OUT 6
|
||||
#define BLEND_STYLE_INSIDE_OUT 7
|
||||
#define BLEND_STYLE_SWIPE_UP 8
|
||||
#define BLEND_STYLE_SWIPE_DOWN 9
|
||||
#define BLEND_STYLE_OPEN_H 10
|
||||
#define BLEND_STYLE_OPEN_V 11
|
||||
#define BLEND_STYLE_PUSH_UP 12
|
||||
#define BLEND_STYLE_PUSH_DOWN 13
|
||||
#define BLEND_STYLE_PUSH_TL 14
|
||||
#define BLEND_STYLE_PUSH_TR 15
|
||||
#define BLEND_STYLE_PUSH_BR 16
|
||||
#define BLEND_STYLE_PUSH_BL 17
|
||||
|
||||
#define BLEND_STYLE_COUNT 14
|
||||
#define BLEND_STYLE_COUNT 18
|
||||
|
||||
|
||||
typedef enum mapping1D2D {
|
||||
|
@ -202,15 +202,39 @@ bool IRAM_ATTR Segment::isPixelXYClipped(int x, int y) {
|
||||
void IRAM_ATTR Segment::setPixelColorXY(int x, int y, uint32_t col)
|
||||
{
|
||||
if (!isActive()) return; // not active
|
||||
if (x >= virtualWidth() || y >= virtualHeight() || x < 0 || y < 0 || isPixelXYClipped(x,y)) return; // if pixel would fall out of virtual segment just exit
|
||||
|
||||
int vW = virtualWidth();
|
||||
int vH = virtualHeight();
|
||||
|
||||
#ifndef WLED_DISABLE_MODE_BLEND
|
||||
if (!_modeBlend &&
|
||||
(blendingStyle == BLEND_STYLE_PUSH_RIGHT ||
|
||||
blendingStyle == BLEND_STYLE_PUSH_LEFT ||
|
||||
blendingStyle == BLEND_STYLE_PUSH_UP ||
|
||||
blendingStyle == BLEND_STYLE_PUSH_DOWN ||
|
||||
blendingStyle == BLEND_STYLE_PUSH_TL ||
|
||||
blendingStyle == BLEND_STYLE_PUSH_TR ||
|
||||
blendingStyle == BLEND_STYLE_PUSH_BR ||
|
||||
blendingStyle == BLEND_STYLE_PUSH_BL)) {
|
||||
unsigned prog = 0xFFFF - progress();
|
||||
unsigned dX = (blendingStyle == BLEND_STYLE_PUSH_UP || blendingStyle == BLEND_STYLE_PUSH_DOWN) ? 0 : prog * vW / 0xFFFF;
|
||||
unsigned dY = (blendingStyle == BLEND_STYLE_PUSH_LEFT || blendingStyle == BLEND_STYLE_PUSH_RIGHT) ? 0 : prog * vH / 0xFFFF;
|
||||
if (blendingStyle == BLEND_STYLE_PUSH_LEFT || blendingStyle == BLEND_STYLE_PUSH_TL || blendingStyle == BLEND_STYLE_PUSH_BL) x -= dX;
|
||||
else x += dX;
|
||||
if (blendingStyle == BLEND_STYLE_PUSH_DOWN || blendingStyle == BLEND_STYLE_PUSH_TL || blendingStyle == BLEND_STYLE_PUSH_TR) y -= dY;
|
||||
else y += dY;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (x >= vW || y >= vH || x < 0 || y < 0 || isPixelXYClipped(x,y)) return; // if pixel would fall out of virtual segment just exit
|
||||
|
||||
uint8_t _bri_t = currentBri();
|
||||
if (_bri_t < 255) {
|
||||
col = color_fade(col, _bri_t);
|
||||
}
|
||||
|
||||
if (reverse ) x = virtualWidth() - x - 1;
|
||||
if (reverse_y) y = virtualHeight() - y - 1;
|
||||
if (reverse ) x = vW - x - 1;
|
||||
if (reverse_y) y = vH - y - 1;
|
||||
if (transpose) { unsigned t = x; x = y; y = t; } // swap X & Y if segment transposed
|
||||
|
||||
x *= groupLength(); // expand to physical pixels
|
||||
@ -294,9 +318,34 @@ void Segment::setPixelColorXY(float x, float y, uint32_t col, bool aa)
|
||||
// returns RGBW values of pixel
|
||||
uint32_t IRAM_ATTR Segment::getPixelColorXY(int x, int y) {
|
||||
if (!isActive()) return 0; // not active
|
||||
if (x >= virtualWidth() || y >= virtualHeight() || x<0 || y<0 || isPixelXYClipped(x,y)) return 0; // if pixel would fall out of virtual segment just exit
|
||||
if (reverse ) x = virtualWidth() - x - 1;
|
||||
if (reverse_y) y = virtualHeight() - y - 1;
|
||||
|
||||
int vW = virtualWidth();
|
||||
int vH = virtualHeight();
|
||||
|
||||
#ifndef WLED_DISABLE_MODE_BLEND
|
||||
if (!_modeBlend &&
|
||||
(blendingStyle == BLEND_STYLE_PUSH_RIGHT ||
|
||||
blendingStyle == BLEND_STYLE_PUSH_LEFT ||
|
||||
blendingStyle == BLEND_STYLE_PUSH_UP ||
|
||||
blendingStyle == BLEND_STYLE_PUSH_DOWN ||
|
||||
blendingStyle == BLEND_STYLE_PUSH_TL ||
|
||||
blendingStyle == BLEND_STYLE_PUSH_TR ||
|
||||
blendingStyle == BLEND_STYLE_PUSH_BR ||
|
||||
blendingStyle == BLEND_STYLE_PUSH_BL)) {
|
||||
unsigned prog = 0xFFFF - progress();
|
||||
unsigned dX = (blendingStyle == BLEND_STYLE_PUSH_UP || blendingStyle == BLEND_STYLE_PUSH_DOWN) ? 0 : prog * vW / 0xFFFF;
|
||||
unsigned dY = (blendingStyle == BLEND_STYLE_PUSH_LEFT || blendingStyle == BLEND_STYLE_PUSH_RIGHT) ? 0 : prog * vH / 0xFFFF;
|
||||
if (blendingStyle == BLEND_STYLE_PUSH_LEFT || blendingStyle == BLEND_STYLE_PUSH_TL || blendingStyle == BLEND_STYLE_PUSH_BL) x -= dX;
|
||||
else x += dX;
|
||||
if (blendingStyle == BLEND_STYLE_PUSH_DOWN || blendingStyle == BLEND_STYLE_PUSH_TL || blendingStyle == BLEND_STYLE_PUSH_TR) y -= dY;
|
||||
else y += dY;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (x >= vW || y >= vH || x<0 || y<0 || isPixelXYClipped(x,y)) return 0; // if pixel would fall out of virtual segment just exit
|
||||
|
||||
if (reverse ) x = vW - x - 1;
|
||||
if (reverse_y) y = vH - y - 1;
|
||||
if (transpose) { unsigned t = x; x = y; y = t; } // swap X & Y if segment transposed
|
||||
x *= groupLength(); // expand to physical pixels
|
||||
y *= groupLength(); // expand to physical pixels
|
||||
|
@ -782,7 +782,8 @@ void IRAM_ATTR Segment::setPixelColor(int i, uint32_t col)
|
||||
#endif
|
||||
i &= 0xFFFF;
|
||||
|
||||
if (i >= virtualLength() || i<0) return; // if pixel would fall out of segment just exit
|
||||
int vL = virtualLength();
|
||||
if (i >= vL || i < 0) return; // if pixel would fall out of segment just exit
|
||||
|
||||
#ifndef WLED_DISABLE_2D
|
||||
if (is2D()) {
|
||||
@ -890,7 +891,16 @@ void IRAM_ATTR Segment::setPixelColor(int i, uint32_t col)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (isPixelClipped(i)) return; // handle clipping on 1D
|
||||
#ifndef WLED_DISABLE_MODE_BLEND
|
||||
if (!_modeBlend && (blendingStyle == BLEND_STYLE_PUSH_RIGHT || blendingStyle == BLEND_STYLE_PUSH_LEFT)) {
|
||||
unsigned prog = 0xFFFF - progress();
|
||||
unsigned dI = prog * vL / 0xFFFF;
|
||||
if (blendingStyle == BLEND_STYLE_PUSH_RIGHT) i -= dI;
|
||||
else i += dI;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (i >= vL || i < 0 || isPixelClipped(i)) return; // handle clipping on 1D
|
||||
|
||||
unsigned len = length();
|
||||
uint8_t _bri_t = currentBri();
|
||||
@ -978,6 +988,9 @@ uint32_t IRAM_ATTR Segment::getPixelColor(int i)
|
||||
#endif
|
||||
i &= 0xFFFF;
|
||||
|
||||
int vL = virtualLength();
|
||||
if (i >= vL || i < 0) return 0;
|
||||
|
||||
#ifndef WLED_DISABLE_2D
|
||||
if (is2D()) {
|
||||
unsigned vH = virtualHeight(); // segment height in logical pixels
|
||||
@ -1029,9 +1042,18 @@ uint32_t IRAM_ATTR Segment::getPixelColor(int i)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (isPixelClipped(i)) return 0; // handle clipping on 1D
|
||||
#ifndef WLED_DISABLE_MODE_BLEND
|
||||
if (!_modeBlend && (blendingStyle == BLEND_STYLE_PUSH_RIGHT || blendingStyle == BLEND_STYLE_PUSH_LEFT)) {
|
||||
unsigned prog = 0xFFFF - progress();
|
||||
unsigned dI = prog * vL / 0xFFFF;
|
||||
if (blendingStyle == BLEND_STYLE_PUSH_RIGHT) i -= dI;
|
||||
else i += dI;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (reverse) i = virtualLength() - i - 1;
|
||||
if (i >= vL || i < 0 || isPixelClipped(i)) return 0; // handle clipping on 1D
|
||||
|
||||
if (reverse) i = vL - i - 1;
|
||||
i *= groupLength();
|
||||
i += start;
|
||||
/* offset/phase */
|
||||
|
@ -271,18 +271,22 @@
|
||||
<select id="bs" class="sel-sg" onchange="requestJson({'bs':parseInt(this.value)})">
|
||||
<option value="0">Fade</option>
|
||||
<option value="1">Fairy Dust</option>
|
||||
<option value="2">Swipe left</option>
|
||||
<option value="3">Swipe right</option>
|
||||
<option value="4">Pinch-out</option>
|
||||
<option value="5">Inside-out</option>
|
||||
<option value="6" data-type="2D">Swipe up</option>
|
||||
<option value="7" data-type="2D">Swipe down</option>
|
||||
<option value="8" data-type="2D">Open V</option>
|
||||
<option value="9" data-type="2D">Open H</option>
|
||||
<option value="10" data-type="2D">Push TL</option>
|
||||
<option value="11" data-type="2D">Push TR</option>
|
||||
<option value="12" data-type="2D">Push BR</option>
|
||||
<option value="13" data-type="2D">Push BL</option>
|
||||
<option value="2">Swipe right</option>
|
||||
<option value="3">Swipe left</option>
|
||||
<option value="4">Push right</option>
|
||||
<option value="5">Push left</option>
|
||||
<option value="6">Pinch-out</option>
|
||||
<option value="7">Inside-out</option>
|
||||
<option value="8" data-type="2D">Swipe up</option>
|
||||
<option value="9" data-type="2D">Swipe down</option>
|
||||
<option value="10" data-type="2D">Open V</option>
|
||||
<option value="11" data-type="2D">Open H</option>
|
||||
<option value="12" data-type="2D">Push up</option>
|
||||
<option value="13" data-type="2D">Push down</option>
|
||||
<option value="14" data-type="2D">Push TL</option>
|
||||
<option value="15" data-type="2D">Push TR</option>
|
||||
<option value="16" data-type="2D">Push BR</option>
|
||||
<option value="17" data-type="2D">Push BL</option>
|
||||
</select>
|
||||
</p>
|
||||
<p id="ledmap" class="hide"></p>
|
||||
|
Loading…
x
Reference in New Issue
Block a user