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

◆ computeOneTwinkle()

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

Definition at line 189 of file twinklefox.h.

189 {
190 uint16_t ticks = ms >> (8 - twinkleSpeed);
191 uint8_t fastcycle8 = ticks;
192 uint16_t slowcycle16 = (ticks >> 8) + salt;
193 slowcycle16 += sin8(slowcycle16);
194 slowcycle16 = (slowcycle16 * 2053) + 1384;
195 uint8_t slowcycle8 = (slowcycle16 & 0xFF) + (slowcycle16 >> 8);
196
197 uint8_t bright = 0;
198 if (((slowcycle8 & 0x0E) / 2) < twinkleDensity) {
199 bright = attackDecayWave8(fastcycle8);
200 }
201
202 uint8_t 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 attackDecayWave8(uint8_t i)
Definition twinklefox.h:215
CRGBPalette16 currentPalette
Definition twinklefox.h:113
uint8_t twinkleSpeed
Definition twinklefox.h:135
bool coolLikeIncandescent
Definition twinklefox.h:137
uint8_t twinkleDensity
Definition twinklefox.h:136
void coolLikeIncandescentFunction(CRGB &c, uint8_t phase)
Definition twinklefox.h:224
#define sin8
Platform-independent alias of the fast sin implementation.
Definition trig8.h:221
CRGB ColorFromPalette(const CRGBPalette16 &pal, uint8_t index, uint8_t brightness, TBlendType blendType)
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Definition crgb.h:504

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

Referenced by drawTwinkleFox().

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