FastLED 3.10.8
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 869 of file noise.cpp.hpp.

872 {
873
874 if (num_leds <= 0) return;
875
876 for (int j = 0; j < num_leds; j += 255) {
877 const int LedsRemaining = num_leds - j;
878 const int LedsPer = LedsRemaining > 255 ? 255 : LedsRemaining; // limit to 255 max
879
880 if (LedsPer <= 0) continue;
881 FASTLED_STACK_ARRAY(fl::u8, V, LedsPer);
882 FASTLED_STACK_ARRAY(fl::u8, H, LedsPer);
883
884 fl::memset(V, 0, LedsPer);
885 fl::memset(H, 0, LedsPer);
886
887 fill_raw_noise8(V, LedsPer, octaves, x, scale, time);
888 fill_raw_noise8(H, LedsPer, hue_octaves, hue_x, hue_scale, time);
889
890 for (int i = 0; i < LedsPer; ++i) {
891 leds[i + j] = CHSV(H[i], 255, V[i]);
892 }
893 }
894}
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()
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_noise8(), FL_NO_EXCEPT, H, hue_octaves, hue_scale, leds, fl::memset(), octaves, scale, and x.

+ Here is the call graph for this function: