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

◆ fill_noise8()

void fill_noise8 ( CRGB * leds,
int num_leds,
fl::u8 octaves,
fl::u16 x,
int scale,
fl::u8 hue_octaves,
fl::u16 hue_x,
int hue_scale,
fl::u16 time )

Fill an LED array with random colors, using 8-bit noise.

Parameters
ledspointer to LED array
num_ledsthe number of LEDs to fill
octavesthe number of octaves to use for value (brightness) noise
xx-axis coordinate on noise map for value (brightness) noise
scalethe scale (distance) between x points when filling in value (brightness) noise
hue_octavesthe number of octaves to use for color hue noise
hue_xx-axis coordinate on noise map for color hue noise
hue_scalethe scale (distance) between x points when filling in color hue noise
timethe time position for the noise field

Definition at line 831 of file noise.cpp.hpp.

834 {
835
836 if (num_leds <= 0) return;
837
838 for (int j = 0; j < num_leds; j += 255) {
839 const int LedsRemaining = num_leds - j;
840 const int LedsPer = LedsRemaining > 255 ? 255 : LedsRemaining; // limit to 255 max
841
842 if (LedsPer <= 0) continue;
843 FASTLED_STACK_ARRAY(fl::u8, V, LedsPer);
844 FASTLED_STACK_ARRAY(fl::u8, H, LedsPer);
845
846 fl::memset(V, 0, LedsPer);
847 fl::memset(H, 0, LedsPer);
848
849 fill_raw_noise8(V, LedsPer, octaves, x, scale, time);
850 fill_raw_noise8(H, LedsPer, hue_octaves, hue_x, hue_scale, time);
851
852 for (int i = 0; i < LedsPer; ++i) {
853 leds[i + j] = CHSV(H[i], 255, V[i]);
854 }
855 }
856}
fl::CRGB leds[NUM_LEDS]
int x
Definition simple.h:92
fl::UISlider scale("Scale", 4,.1, 4,.1)
uint8_t hue_octaves
uint8_t octaves
int hue_scale
static const int H
Definition PerfDisc.ino:20
#define FASTLED_STACK_ARRAY(TYPE, NAME, SIZE)
Stack-allocated array with automatic zero-initialization.
Definition alloca.h:32
fl::hsv8 CHSV
Definition chsv.h:11
void fill_raw_noise8(fl::u8 *pData, fl::u8 num_points, fl::u8 octaves, fl::u16 x, int scale, fl::u16 time)
Fill a 1D 8-bit buffer with noise, using inoise8()
unsigned char u8
Definition stdint.h:131
void * memset(void *s, int c, size_t n) FL_NOEXCEPT

References FASTLED_STACK_ARRAY, fill_raw_noise8(), H, hue_octaves, hue_scale, leds, fl::memset(), octaves, scale, and x.

+ Here is the call graph for this function: