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

◆ render()

void mood_ring::BreathLayer::render ( const RoomSense & s,
const MoodPalette & pal,
float dtSec,
RingCanvas & c )

Definition at line 59 of file layers.cpp.

60 {
61 (void)s;
62 mBreath += kTwoPi * kBreathHz * dtSec;
63 while (mBreath > kTwoPi)
64 mBreath -= kTwoPi;
65 mPosA = advance(mPosA, kBreathDriftTurnsPerSec, dtSec);
66 mPosB = advance(mPosB, -kBreathDriftTurnsPerSec * 0.7f, dtSec);
67
68 // Whole-ring breath between floor and a restrained ceiling.
69 const float breath =
70 kBreathFloor + 0.25f * (0.5f + 0.5f * fl::sin(mBreath));
71 c.fill(paletteColor(pal, 0.0f), breath);
72
73 // Two blobs on opposite ends of the family, each breathing out of phase.
74 const float aGain = 0.35f + 0.25f * (0.5f + 0.5f * fl::sin(mBreath + 1.2f));
75 const float bGain = 0.35f + 0.25f * (0.5f + 0.5f * fl::sin(mBreath + 3.6f));
76 c.lobe(mPosA, kBreathSigma, paletteColor(pal, 0.35f), aGain);
77 c.lobe(mPosB, kBreathSigma, paletteColor(pal, 1.0f), bGain);
78}
float mPosA
turns
Definition layers.h:31
float mBreath
radians
Definition layers.h:30
enable_if< is_fixed_point< T >::value, T >::type sin(T angle) FL_NO_EXCEPT
float advance(float pos, float turnsPerSec, float dtSec)
Definition layers.cpp:43
RGBf paletteColor(const MoodPalette &p, float t)
Colour at position t in [0, 1] along the family, at value v.

References mood_ring::RingCanvas::fill(), mood_ring::RingCanvas::lobe(), mBreath, mPosA, mPosB, mood_ring::paletteColor(), and fl::sin().

+ Here is the call graph for this function: