Skip to content

Commit

Permalink
Effect: 2D Drift gets original twin option
Browse files Browse the repository at this point in the history
  • Loading branch information
blazoncek committed Mar 12, 2024
1 parent 88b30e7 commit 7b366d4
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions wled00/FX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5018,17 +5018,18 @@ uint16_t mode_2DDrift() { // By: Stepko https://editor.soulmateli
const uint16_t maxDim = MAX(cols, rows)/2;
unsigned long t = strip.now / (32 - (SEGMENT.speed>>3));
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));
uint16_t myX = colsCenter + (sin_t(angle) * i);
uint16_t myY = rowsCenter + (cos_t(angle) * i);
SEGMENT.setPixelColorXY(myX, myY, ColorFromPalette(SEGPALETTE, (i * 20) + t_20, 255, LINEARBLEND));
int16_t mySin = sin_t(angle) * i;
int16_t myCos = cos_t(angle) * i;
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);

return FRAMETIME;
} // 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";


//////////////////////////
Expand Down Expand Up @@ -6201,8 +6202,9 @@ uint16_t mode_2Ddriftrose(void) {

SEGMENT.fadeToBlackBy(32+(SEGMENT.speed>>3));
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;
uint32_t y = (CY + (cos_t(radians(i * 10)) * (beatsin8(i, 0, L*2)-L))) * 255.f;
float angle = radians(i * 10);
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.blur((SEGMENT.intensity>>4)+1);
Expand Down

0 comments on commit 7b366d4

Please sign in to comment.