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

◆ fill_noise16()

void fill_noise16 ( 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,
uint8_t hue_shift = 0 )

Fill an LED array with random colors, using 16-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
hue_shifthow much to shift the final hues by for every LED

Definition at line 898 of file noise.cpp.

901 {
902
903 if (num_leds <= 0) return;
904
905 for (int j = 0; j < num_leds; j += 255) {
906 const int LedsRemaining = num_leds - j;
907 const int LedsPer = LedsRemaining > 255 ? 255 : LedsRemaining; // limit to 255 max
908 if (LedsPer <= 0) continue;
909 VARIABLE_LENGTH_ARRAY(uint8_t, V, LedsPer);
910 VARIABLE_LENGTH_ARRAY(uint8_t, H, LedsPer);
911
912 memset(V, 0, LedsPer);
913 memset(H, 0, LedsPer);
914
915 fill_raw_noise16into8(V, LedsPer, octaves, x, scale, time);
916 fill_raw_noise8(H, LedsPer, hue_octaves, hue_x, hue_scale, time);
917
918 for (int i = 0; i < LedsPer; ++i) {
919 leds[i + j] = CHSV(H[i] + hue_shift, 255, V[i]);
920 }
921 }
922}
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
void fill_raw_noise16into8(uint8_t *pData, uint8_t num_points, uint8_t octaves, uint32_t x, int scale, uint32_t time)
Fill a 1D 8-bit buffer with noise, using inoise16()
Definition noise.cpp:728
#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_noise16into8(), fill_raw_noise8(), hue_octaves, hue_scale, leds, octaves, scale, VARIABLE_LENGTH_ARRAY, and x.

+ Here is the call graph for this function: