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

◆ paletteColor()

RGBf mood_ring::paletteColor ( const MoodPalette & p,
float t )

Colour at position t in [0, 1] along the family, at value v.

Definition at line 42 of file mood_palette.cpp.

42 {
43 // Hue is quantised to the 256-step wheel, but neighbouring hues differ
44 // by about one unit per channel at full value, so a slow drift reads as
45 // continuous. Everything after this point stays in float.
46 const float tt = clampf(t, 0.0f, 1.0f);
47 const fl::u8 hue = static_cast<fl::u8>(
48 p.hueBase + static_cast<fl::u8>(tt * static_cast<float>(p.hueSpread)));
49 return toRGBf(CRGB(CHSV(hue, p.saturation, 255)));
50}
uint8_t hue
Definition advanced.h:94
static uint32_t t
Definition Luminova.h:55
fl::hsv8 CHSV
Definition chsv.h:11
fl::CRGB CRGB
Definition crgb.h:25
unsigned char u8
Definition stdint.h:131
RGBf toRGBf(CRGB c)
float clampf(float v, float lo, float hi)
Definition ring_canvas.h:19
fl::u8 hueSpread
how far t=1 travels from t=0
fl::u8 hueBase
centre of the family

References clampf(), hue, mood_ring::MoodPalette::hueBase, mood_ring::MoodPalette::hueSpread, mood_ring::MoodPalette::saturation, t, and toRGBf().

Referenced by mood_ring::FlowLayer::drawGrains(), mood_ring::MoodPainter::drawPulses(), 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: