mirror of
https://github.com/wled/WLED.git
synced 2025-07-25 19:56:32 +00:00
Effect: 2D Drift gets original twin option
This commit is contained in:
parent
88b30e7e28
commit
7b366d49d2
@ -5018,17 +5018,18 @@ uint16_t mode_2DDrift() { // By: Stepko https://editor.soulmateli
|
|||||||
const uint16_t maxDim = MAX(cols, rows)/2;
|
const uint16_t maxDim = MAX(cols, rows)/2;
|
||||||
unsigned long t = strip.now / (32 - (SEGMENT.speed>>3));
|
unsigned long t = strip.now / (32 - (SEGMENT.speed>>3));
|
||||||
unsigned long t_20 = t/20; // softhack007: pre-calculating this gives about 10% speedup
|
unsigned long t_20 = t/20; // softhack007: pre-calculating this gives about 10% speedup
|
||||||
for (float i = 1; i < maxDim; i += 0.25) {
|
for (float i = 1.0f; i < maxDim; i += 0.25f) {
|
||||||
float angle = radians(t * (maxDim - i));
|
float angle = radians(t * (maxDim - i));
|
||||||
uint16_t myX = colsCenter + (sin_t(angle) * i);
|
int16_t mySin = sin_t(angle) * i;
|
||||||
uint16_t myY = rowsCenter + (cos_t(angle) * i);
|
int16_t myCos = cos_t(angle) * i;
|
||||||
SEGMENT.setPixelColorXY(myX, myY, ColorFromPalette(SEGPALETTE, (i * 20) + t_20, 255, LINEARBLEND));
|
SEGMENT.setPixelColorXY(colsCenter + mySin, rowsCenter + myCos, ColorFromPalette(SEGPALETTE, (i * 20) + t_20, 255, LINEARBLEND));
|
||||||
|
if (SEGMENT.check1) SEGMENT.setPixelColorXY(colsCenter + myCos, rowsCenter + mySin, ColorFromPalette(SEGPALETTE, (i * 20) + t_20, 255, LINEARBLEND));
|
||||||
}
|
}
|
||||||
SEGMENT.blur(SEGMENT.intensity>>3);
|
SEGMENT.blur(SEGMENT.intensity>>3);
|
||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_2DDrift()
|
} // mode_2DDrift()
|
||||||
static const char _data_FX_MODE_2DDRIFT[] PROGMEM = "Drift@Rotation speed,Blur amount;;!;2";
|
static const char _data_FX_MODE_2DDRIFT[] PROGMEM = "Drift@Rotation speed,Blur amount,,,,Twin;;!;2";
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
@ -6201,8 +6202,9 @@ uint16_t mode_2Ddriftrose(void) {
|
|||||||
|
|
||||||
SEGMENT.fadeToBlackBy(32+(SEGMENT.speed>>3));
|
SEGMENT.fadeToBlackBy(32+(SEGMENT.speed>>3));
|
||||||
for (size_t i = 1; i < 37; i++) {
|
for (size_t i = 1; i < 37; i++) {
|
||||||
uint32_t x = (CX + (sin_t(radians(i * 10)) * (beatsin8(i, 0, L*2)-L))) * 255.f;
|
float angle = radians(i * 10);
|
||||||
uint32_t y = (CY + (cos_t(radians(i * 10)) * (beatsin8(i, 0, L*2)-L))) * 255.f;
|
uint32_t x = (CX + (sin_t(angle) * (beatsin8(i, 0, L*2)-L))) * 255.f;
|
||||||
|
uint32_t y = (CY + (cos_t(angle) * (beatsin8(i, 0, L*2)-L))) * 255.f;
|
||||||
SEGMENT.wu_pixel(x, y, CHSV(i * 10, 255, 255));
|
SEGMENT.wu_pixel(x, y, CHSV(i * 10, 255, 255));
|
||||||
}
|
}
|
||||||
SEGMENT.blur((SEGMENT.intensity>>4)+1);
|
SEGMENT.blur((SEGMENT.intensity>>4)+1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user