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

◆ computeOneTwinkle()

CRGB fl::TwinkleFox::computeOneTwinkle ( uint32_t ms,
uint8_t salt )
inlineprivate

Definition at line 191 of file twinklefox.h.

191 {
192 uint16_t ticks = ms >> (8 - twinkleSpeed);
193 uint8_t fastcycle8 = ticks;
194 uint16_t slowcycle16 = (ticks >> 8) + salt;
195 slowcycle16 += sin8(slowcycle16);
196 slowcycle16 = (slowcycle16 * 2053) + 1384;
197 uint8_t slowcycle8 = (slowcycle16 & 0xFF) + (slowcycle16 >> 8);
198
199 uint8_t bright = 0;
200 if (((slowcycle8 & 0x0E) / 2) < twinkleDensity) {
201 bright = attackDecayWave8(fastcycle8);
202 }
203
204 uint8_t hue = slowcycle8 - salt;
205 CRGB c;
206 if (bright > 0) {
207 c = ColorFromPalette(currentPalette, hue, bright, NOBLEND);
209 coolLikeIncandescentFunction(c, fastcycle8);
210 }
211 } else {
212 c = CRGB::Black;
213 }
214 return c;
215 }
uint8_t attackDecayWave8(uint8_t i)
Definition twinklefox.h:217
CRGBPalette16 currentPalette
Definition twinklefox.h:115
uint8_t twinkleSpeed
Definition twinklefox.h:137
bool coolLikeIncandescent
Definition twinklefox.h:139
uint8_t twinkleDensity
Definition twinklefox.h:138
void coolLikeIncandescentFunction(CRGB &c, uint8_t phase)
Definition twinklefox.h:226
@ NOBLEND
No interpolation between palette entries.
CRGB ColorFromPalette(const CRGBPalette16 &pal, uint8_t index, uint8_t brightness, TBlendType blendType)
Get a color from a palette.
#define sin8
Platform-independent alias of the fast sin implementation.
Definition trig8.h:216
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Definition crgb.h:499

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

Referenced by drawTwinkleFox().

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