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

◆ computeOneTwinkle()

CRGB fl::TwinkleFox::computeOneTwinkle ( fl::u32 ms,
u8 salt )
inlineprivate

Definition at line 187 of file twinklefox.h.

187 {
188 u16 ticks = ms >> (8 - twinkleSpeed);
189 u8 fastcycle8 = ticks;
190 u16 slowcycle16 = (ticks >> 8) + salt;
191 slowcycle16 += sin8(slowcycle16);
192 slowcycle16 = (slowcycle16 * 2053) + 1384;
193 u8 slowcycle8 = (slowcycle16 & 0xFF) + (slowcycle16 >> 8);
194
195 u8 bright = 0;
196 if (((slowcycle8 & 0x0E) / 2) < twinkleDensity) {
197 bright = attackDecayWave8(fastcycle8);
198 }
199
200 u8 hue = slowcycle8 - salt;
201 CRGB c;
202 if (bright > 0) {
203 c = ColorFromPalette(currentPalette, hue, bright, NOBLEND);
205 coolLikeIncandescentFunction(c, fastcycle8);
206 }
207 } else {
208 c = CRGB::Black;
209 }
210 return c;
211 }
uint8_t hue
Definition advanced.h:94
u8 attackDecayWave8(u8 i)
Definition twinklefox.h:213
CRGBPalette16 currentPalette
Definition twinklefox.h:111
void coolLikeIncandescentFunction(CRGB &c, u8 phase)
Definition twinklefox.h:222
bool coolLikeIncandescent
Definition twinklefox.h:135
unsigned char u8
Definition stdint.h:131
fl::CRGB CRGB
Definition video.h:15
CRGB ColorFromPalette(const CRGBPalette16 &pal, fl::u8 index, fl::u8 brightness, TBlendType blendType)
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Definition crgb.h:510

References attackDecayWave8(), fl::CRGB::Black, fl::ColorFromPalette(), coolLikeIncandescent, coolLikeIncandescentFunction(), currentPalette, hue, twinkleDensity, and twinkleSpeed.

Referenced by drawTwinkleFox().

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