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

◆ fill_noise8()

void fill_noise8 ( CRGB * leds,
int num_leds,
uint8_t octaves,
uint16_t x,
int scale,
uint8_t hue_octaves,
uint16_t hue_x,
int hue_scale,
uint16_t 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 871 of file noise.cpp.

874 {
875
876 if (num_leds <= 0) return;
877
878 for (int j = 0; j < num_leds; j += 255) {
879 const int LedsRemaining = num_leds - j;
880 const int LedsPer = LedsRemaining > 255 ? 255 : LedsRemaining; // limit to 255 max
881
882 if (LedsPer <= 0) continue;
883 VARIABLE_LENGTH_ARRAY(uint8_t, V, LedsPer);
884 VARIABLE_LENGTH_ARRAY(uint8_t, H, LedsPer);
885
886 memset(V, 0, LedsPer);
887 memset(H, 0, LedsPer);
888
889 fill_raw_noise8(V, LedsPer, octaves, x, scale, time);
890 fill_raw_noise8(H, LedsPer, hue_octaves, hue_x, hue_scale, time);
891
892 for (int i = 0; i < LedsPer; ++i) {
893 leds[i + j] = CHSV(H[i], 255, V[i]);
894 }
895 }
896}
CRGB leds[NUM_LEDS]
Definition Apa102.ino:11
uint32_t x[NUM_LAYERS]
Definition Fire2023.ino:80
UISlider scale("Scale", 4,.1, 4,.1)
uint8_t hue_octaves
uint8_t octaves
int hue_scale
void fill_raw_noise8(uint8_t *pData, uint8_t num_points, uint8_t octaves, uint16_t x, int scale, uint16_t time)
Fill a 1D 8-bit buffer with noise, using inoise8()
Definition noise.cpp:715
#define VARIABLE_LENGTH_ARRAY(TYPE, NAME, SIZE)
Definition noise.cpp:19
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
Definition chsv.h:16

References fill_raw_noise8(), hue_octaves, hue_scale, leds, octaves, scale, VARIABLE_LENGTH_ARRAY, and x.

+ Here is the call graph for this function: