/
confetti_pal.h
30 lines (23 loc) · 1.1 KB
/
confetti_pal.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef CONFETTI_PAL_H
#define CONFETTI_PAL_H
/* This is adapted from the confetti routine created by Mark Kriegsman */
/* Usage - confetti_pal();
*
* thisfade
* thisdelay
* currentPalette and targetPalette
* thisdiff
* thisindex
* thisinc
* thisbright
*/
void confetti_pal() { // random colored speckles that blink in and fade smoothly
// EVERY_N_SECONDS(5) {
// SetupSimilar4Palette();
// }
fadeToBlackBy(leds, NUM_LEDS, thisfade);
int pos = random8(NUM_LEDS); // Pick an LED at random.
leds[pos] = ColorFromPalette(currentPalette, thisindex + random8(thisdiff)/4 , thisbright, currentBlending); // Munge the values and pick a colour from the palette
thisindex = thisindex + thisinc; // base palette counter increments here.
} // confetti_pal()
#endif