FastLED 3.10.8
Loading...
Searching...
No Matches

◆ fill_noise16()

void fill_noise16 ( 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,
fl::u8 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 896 of file noise.cpp.hpp.

899 {
900
901 if (num_leds <= 0) return;
902
903 for (int j = 0; j < num_leds; j += 255) {
904 const int LedsRemaining = num_leds - j;
905 const int LedsPer = LedsRemaining > 255 ? 255 : LedsRemaining; // limit to 255 max
906 if (LedsPer <= 0) continue;
907 FASTLED_STACK_ARRAY(fl::u8, V, LedsPer);
908 FASTLED_STACK_ARRAY(fl::u8, H, LedsPer);
909
910 fl::memset(V, 0, LedsPer);
911 fl::memset(H, 0, LedsPer);
912
913 fill_raw_noise16into8(V, LedsPer, octaves, x, scale, time);
914 fill_raw_noise8(H, LedsPer, hue_octaves, hue_x, hue_scale, time);
915
916 for (int i = 0; i < LedsPer; ++i) {
917 leds[i + j] = CHSV(H[i] + hue_shift, 255, V[i]);
918 }
919 }
920}
CRGB leds[1]
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:21
#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) FL_NO_EXCEPT
Fill a 1D 8-bit buffer with noise, using inoise8()
void fill_raw_noise16into8(fl::u8 *pData, fl::u8 num_points, fl::u8 octaves, fl::u32 x, int scale, fl::u32 time) FL_NO_EXCEPT
Fill a 1D 8-bit buffer with noise, using inoise16()
unsigned char u8
Definition stdint.h:131
FASTLED_FORCE_INLINE void * memset(void *s, int c, size_t n) FL_NO_EXCEPT
Definition cstring.h:148

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

+ Here is the call graph for this function: