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

◆ lobe()

void mood_ring::RingCanvas::lobe ( float pos,
float sigma,
const RGBf & color,
float gain )

Add a smooth lobe centred at pos (turns) with half-width sigma (turns).

Definition at line 110 of file ring_canvas.cpp.

110 {
111 const int n = size();
112 if (n <= 0 || gain <= 0.0f || sigma <= 0.0f)
113 return;
114 for (int i = 0; i < n; ++i) {
115 const float k = falloff(ringDistance(posOf(i), pos), sigma);
116 if (k <= 0.0f)
117 continue;
118 pixel(i, color, gain * k);
119 }
120}
uint8_t pos
Definition Blur.ino:11
float posOf(int i) const
Position of pixel i in turns.
void pixel(int i, const RGBf &color, float gain)
Add to one pixel, index wrapped.
float ringDistance(float a, float b)
Shortest distance between two ring positions, in turns, in [0, 0.5].
float falloff(float distance, float sigma)
Smooth bump: 1 at distance 0, 0 at distance >= sigma.

References mood_ring::falloff(), pixel(), pos, posOf(), mood_ring::ringDistance(), and size().

Referenced by mood_ring::BreathLayer::render(), mood_ring::FlowLayer::render(), and mood_ring::GrooveLayer::render().

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