FastLED 3.9.15
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 858 of file noise.cpp.hpp.

861 {
862
863 if (num_leds <= 0) return;
864
865 for (int j = 0; j < num_leds; j += 255) {
866 const int LedsRemaining = num_leds - j;
867 const int LedsPer = LedsRemaining > 255 ? 255 : LedsRemaining; // limit to 255 max
868 if (LedsPer <= 0) continue;
869 FASTLED_STACK_ARRAY(fl::u8, V, LedsPer);
870 FASTLED_STACK_ARRAY(fl::u8, H, LedsPer);
871
872 fl::memset(V, 0, LedsPer);
873 fl::memset(H, 0, LedsPer);
874
875 fill_raw_noise16into8(V, LedsPer, octaves, x, scale, time);
876 fill_raw_noise8(H, LedsPer, hue_octaves, hue_x, hue_scale, time);
877
878 for (int i = 0; i < LedsPer; ++i) {
879 leds[i + j] = CHSV(H[i] + hue_shift, 255, V[i]);
880 }
881 }
882}
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()
void fill_raw_noise16into8(fl::u8 *pData, fl::u8 num_points, fl::u8 octaves, fl::u32 x, int scale, fl::u32 time)
Fill a 1D 8-bit buffer with noise, using inoise16()
unsigned char u8
Definition stdint.h:131
void * memset(void *s, int c, size_t n) FL_NOEXCEPT

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

+ Here is the call graph for this function: