FastLED 3.10.6
Loading...
Searching...
No Matches

◆ applyTrails()

void mood_ring::MoodPainter::applyTrails ( float keep)
private

Definition at line 117 of file mood_painter.cpp.

117 {
118 // Persistence by per-channel max, not accumulation: unity gain by
119 // construction, so a static frame yields exactly itself and a keep of
120 // zero is a pure passthrough. In float, so a dim tail fades smoothly
121 // to nothing instead of stepping 3 -> 2 -> 1 -> 0.
122 keep = clampf(keep, 0.0f, 0.98f);
123 const fl::size n = mMix.size();
124 for (fl::size i = 0; i < n; ++i) {
125 RGBf &t = mTrail[i];
126 RGBf &live = mMix[i];
127 t.r *= keep;
128 t.g *= keep;
129 t.b *= keep;
130 if (t.r < kTrailFloor)
131 t.r = 0.0f;
132 if (t.g < kTrailFloor)
133 t.g = 0.0f;
134 if (t.b < kTrailFloor)
135 t.b = 0.0f;
136 if (live.r > t.r)
137 t.r = live.r;
138 if (live.g > t.g)
139 t.g = live.g;
140 if (live.b > t.b)
141 t.b = live.b;
142 live = t;
143 }
144}
fl::vector< RGBf > mTrail
persistence shadow
fl::vector< RGBf > mMix
this frame, summed
static uint32_t t
Definition Luminova.h:55
float clampf(float v, float lo, float hi)
Definition ring_canvas.h:19

References mood_ring::RGBf::b, mood_ring::clampf(), mood_ring::RGBf::g, mMix, mTrail, mood_ring::RGBf::r, and t.

Referenced by draw().

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