MCPcopy Create free account
hub / github.com/FastLED/FastLED / pacifica_one_layer

Method pacifica_one_layer

src/fl/fx/1d/pacifica.h:88–104  ·  view source on GitHub ↗

Add one layer of waves into the led array

Source from the content-addressed store, hash-verified

86
87// Add one layer of waves into the led array
88void Pacifica::pacifica_one_layer(fl::span<CRGB> leds, CRGBPalette16 &p,
89 u16 cistart, u16 wavescale,
90 u8 bri, u16 ioff) {
91 u16 ci = cistart;
92 u16 waveangle = ioff;
93 u16 wavescale_half = (wavescale / 2) + 20;
94 for (u16 i = 0; i < mNumLeds; i++) {
95 waveangle += 250;
96 u16 s16 = sin16(waveangle) + 32768;
97 u16 cs = scale16(s16, wavescale_half) + wavescale_half;
98 ci += cs;
99 u16 sindex16 = sin16(ci) + 32768;
100 u8 sindex8 = scale16(sindex16, 240);
101 CRGB c = ColorFromPalette(p, sindex8, bri, LINEARBLEND);
102 leds[i] += c;
103 }
104}
105
106// Add extra 'white' to areas where the four layers of light have lined up
107// brightly

Callers

nothing calls this directly

Calls 2

ColorFromPaletteFunction · 0.85
sin16Function · 0.50

Tested by

no test coverage detected