FastLED 3.10.8
Loading...
Searching...
No Matches

◆ computeOneTwinkle()

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

Definition at line 189 of file twinklefox.h.

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

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

Referenced by drawTwinkleFox().

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