FastLED 3.9.15
Loading...
Searching...
No Matches

◆ plotSoftDot()

void plotSoftDot ( float fx,
float fy,
float s )

Definition at line 84 of file Luminova.h.

84 {
85 // map s (decays from 5) to a pixel radius 1..3
86 float r = constrain(s * 0.5f, 1.0f, 3.0f);
87 int R = (int)ceilf(r);
88 int cx = (int)roundf(fx);
89 int cy = (int)roundf(fy);
90 float r2 = r * r;
91 for (int dy = -R; dy <= R; ++dy) {
92 for (int dx = -R; dx <= R; ++dx) {
93 float d2 = dx * dx + dy * dy;
94 if (d2 <= r2) {
95 // falloff toward edge
96 float fall = 1.0f - (d2 / (r2 + 0.0001f));
97 uint8_t v = (uint8_t)constrain(255.0f * fall, 0.0f, 255.0f);
98 plotDot(cx + dx, cy + dy, v);
99 }
100 }
101 }
102}
void plotDot(int x, int y, uint8_t v)
Definition Luminova.h:76

References plotDot().

Referenced by loop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: