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

◆ computeOneTwinkle()

CRGB computeOneTwinkle ( uint32_t ms,
uint8_t salt )
Examples
TwinkleFox.ino.

Definition at line 234 of file TwinkleFox.ino.

235{
236 uint16_t ticks = ms >> (8-TWINKLE_SPEED);
237 uint8_t fastcycle8 = ticks;
238 uint16_t slowcycle16 = (ticks >> 8) + salt;
239 slowcycle16 += sin8( slowcycle16);
240 slowcycle16 = (slowcycle16 * 2053) + 1384;
241 uint8_t slowcycle8 = (slowcycle16 & 0xFF) + (slowcycle16 >> 8);
242
243 uint8_t bright = 0;
244 if( ((slowcycle8 & 0x0E)/2) < TWINKLE_DENSITY) {
245 bright = attackDecayWave8( fastcycle8);
246 }
247
248 uint8_t hue = slowcycle8 - salt;
249 CRGB c;
250 if( bright > 0) {
251 c = ColorFromPalette( gCurrentPalette, hue, bright, NOBLEND);
252 if( COOL_LIKE_INCANDESCENT == 1 ) {
253 coolLikeIncandescent( c, fastcycle8);
254 }
255 } else {
256 c = CRGB::Black;
257 }
258 return c;
259}
void coolLikeIncandescent(CRGB &c, uint8_t phase)
uint8_t attackDecayWave8(uint8_t i)
#define TWINKLE_SPEED
#define TWINKLE_DENSITY
CRGBPalette16 gCurrentPalette
#define COOL_LIKE_INCANDESCENT
uint8_t hue
Definition advanced.h:94
CRGB ColorFromPalette(const CRGBPalette16 &pal, fl::u8 index, fl::u8 brightness, TBlendType blendType) FL_NO_EXCEPT
fl::CRGB CRGB
Definition crgb.h:25
fl::u16 uint16_t
Definition s16x16x4.h:214
unsigned char uint8_t
Definition s16x16x4.h:209
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Definition crgb.h:517

References attackDecayWave8(), fl::CRGB::Black, ColorFromPalette(), COOL_LIKE_INCANDESCENT, coolLikeIncandescent(), gCurrentPalette, hue, TWINKLE_DENSITY, and TWINKLE_SPEED.

Referenced by drawTwinkles().

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