Merge branch '0_15' into new-KITT
This commit is contained in:
@@ -5016,21 +5016,25 @@ uint16_t mode_2DDrift() { // By: Stepko https://editor.soulmateli
|
||||
const uint16_t cols = SEGMENT.virtualWidth();
|
||||
const uint16_t rows = SEGMENT.virtualHeight();
|
||||
|
||||
const uint16_t colsCenter = (cols>>1) + (cols%2);
|
||||
const uint16_t rowsCenter = (rows>>1) + (rows%2);
|
||||
|
||||
SEGMENT.fadeToBlackBy(128);
|
||||
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 = (cols>>1) + (uint16_t)(sin_t(angle) * i) + (cols%2);
|
||||
uint16_t myY = (rows>>1) + (uint16_t)(cos_t(angle) * i) + (rows%2);
|
||||
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";
|
||||
|
||||
|
||||
//////////////////////////
|
||||
@@ -6203,8 +6207,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);
|
||||
|
||||
Reference in New Issue
Block a user