mirror of
https://github.com/wled/WLED.git
synced 2025-07-15 06:46:34 +00:00
bugfix for holes in 2D DNA Spiral
Holes were visible at height > 32. Root cause: "lerp8x8" seems to be inaccurate --> replaced by a simple linear calculation.
This commit is contained in:
parent
262af0678f
commit
402fba734a
@ -5010,9 +5010,11 @@ uint16_t mode_2DDNASpiral() { // By: ldirko https://editor.soulma
|
|||||||
// draw a gradient line between x and x1
|
// draw a gradient line between x and x1
|
||||||
x = x / 2; x1 = x1 / 2;
|
x = x / 2; x1 = x1 / 2;
|
||||||
unsigned steps = abs8(x - x1) + 1;
|
unsigned steps = abs8(x - x1) + 1;
|
||||||
|
bool positive = (x1 >= x); // direction of drawing
|
||||||
for (size_t k = 1; k <= steps; k++) {
|
for (size_t k = 1; k <= steps; k++) {
|
||||||
unsigned rate = k * 255 / steps;
|
unsigned rate = k * 255 / steps;
|
||||||
unsigned dx = lerp8by8(x, x1, rate);
|
//unsigned dx = lerp8by8(x, x1, rate);
|
||||||
|
unsigned dx = positive? (x + k-1) : (x - k+1); // behaves the same as "lerp8by8" but does not create holes
|
||||||
//SEGMENT.setPixelColorXY(dx, i, ColorFromPalette(SEGPALETTE, hue, 255, LINEARBLEND).nscale8_video(rate));
|
//SEGMENT.setPixelColorXY(dx, i, ColorFromPalette(SEGPALETTE, hue, 255, LINEARBLEND).nscale8_video(rate));
|
||||||
SEGMENT.addPixelColorXY(dx, i, ColorFromPalette(SEGPALETTE, hue, 255, LINEARBLEND)); // use setPixelColorXY for different look
|
SEGMENT.addPixelColorXY(dx, i, ColorFromPalette(SEGPALETTE, hue, 255, LINEARBLEND)); // use setPixelColorXY for different look
|
||||||
SEGMENT.fadePixelColorXY(dx, i, rate);
|
SEGMENT.fadePixelColorXY(dx, i, rate);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user