Added PinWheel Expand1D Effect
This commit is contained in:
@@ -354,7 +354,8 @@ typedef enum mapping1D2D {
|
||||
M12_pCorner = 3,
|
||||
M12_jMap = 4, //WLEDMM jMap
|
||||
M12_sCircle = 5, //WLEDMM Circle
|
||||
M12_sBlock = 6 //WLEDMM Block
|
||||
M12_sBlock = 6, //WLEDMM Block
|
||||
M12_sPinWheel = 7 //WLEDMM PinWheel
|
||||
} mapping1D2D_t;
|
||||
|
||||
// segment, 72 bytes
|
||||
|
||||
@@ -805,6 +805,9 @@ uint16_t Segment::virtualLength() const {
|
||||
else
|
||||
vLen = max(vW,vH) * 0.5; // get the longest dimension
|
||||
break;
|
||||
case M12_sPinWheel: //WLEDMM
|
||||
vLen = 360; // full circle
|
||||
break;
|
||||
}
|
||||
return vLen;
|
||||
}
|
||||
@@ -932,6 +935,27 @@ void IRAM_ATTR_YN Segment::setPixelColor(int i, uint32_t col) //WLEDMM: IRAM_ATT
|
||||
}
|
||||
}
|
||||
break;
|
||||
case M12_sPinWheel: {
|
||||
// i = 0 through 359
|
||||
int centerX = vW / 2;
|
||||
int centerY = vH / 2;
|
||||
// int maxDistance = sqrt(centerX * centerX + centerY * centerY) + 1;
|
||||
|
||||
int distance = 1;
|
||||
float cosVal = cos(i * DEG_TO_RAD); // i = current angle
|
||||
float sinVal = sin(i * DEG_TO_RAD);
|
||||
while (true) {
|
||||
int x = centerX + distance * cosVal;
|
||||
int y = centerY + distance * sinVal;
|
||||
// Check bounds
|
||||
if (x < 0 || x >= vW || y < 0 || y >= vH) {
|
||||
break;
|
||||
}
|
||||
setPixelColorXY(x, y, col);
|
||||
distance++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
} else if (Segment::maxHeight!=1 && (width()==1 || height()==1)) {
|
||||
|
||||
@@ -779,6 +779,7 @@ function populateSegments(s)
|
||||
`<option value="4" ${inst.m12==4?' selected':''}>jMap ☾</option>`+
|
||||
`<option value="5" ${inst.m12==5?' selected':''}>Circle ☾</option>`+
|
||||
`<option value="6" ${inst.m12==6?' selected':''}>Block ☾</option>`+
|
||||
`<option value="6" ${inst.m12==7?' selected':''}>PinWheel ☾</option>`+
|
||||
`</select></div>`+
|
||||
`</div>`;
|
||||
let sndSim = `<div data-snd="si" class="lbl-s hide">Sound sim<br>`+
|
||||
|
||||
Reference in New Issue
Block a user