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

◆ showGenerative()

void showGenerative ( uint32_t now)

Definition at line 182 of file old.h.

182 {
183 // This function is called to show the generative pattern
184 for (int i = 0; i < NUM_LEDS; i++) {
185 // Get the 2D position of this LED from the screen map
187 float x = pos.x;
188 float y = pos.y;
189 float z = pos.z;
190
191 x*= 20.0f * ledsScale.value();
192 y*= 20.0f * ledsScale.value();
193 z*= 20.0f * ledsScale.value();
194
195 uint16_t noise_value = inoise16(x,y,z, now / 100);
196 // Normalize the noise value to 0-255
197 uint8_t brightness = map(noise_value, 0, 65535, 0, 255);
198 // Create a hue that changes with position and time
199 uint8_t sat = int32_t((x * 10 + y * 5 + now / 5)) % 256;
200 // Set the color
201 leds[i] = CHSV(170, sat, fl::clamp(255- sat, 64, 255));
202 }
203}
CRGB leds[NUM_LEDS]
Definition Apa102.ino:11
#define NUM_LEDS
Definition Apa102.ino:6
int y
Definition Audio.ino:72
int x
Definition Audio.ino:71
uint8_t pos
Definition Blur.ino:11
uint32_t z[NUM_LAYERS]
Definition Fire2023.ino:84
UISlider brightness("Brightness", 255, 0, 255, 1)
UISlider ledsScale("Leds scale", 0.1f, 0.1f, 1.0f, 0.01f)
uint16_t inoise16(uint32_t x, uint32_t y, uint32_t z, uint32_t t)
16-bit, fixed point implementation of Perlin's noise.
Definition noise.cpp:440
long map(long x, long in_min, long in_max, long out_min, long out_max)
FASTLED_FORCE_INLINE T clamp(T value, T min, T max)
Definition clamp.h:10
vec3< float > vec3f
Definition geometry.h:173
fl::vector< vec3f > mapCorkScrew
Definition old.h:143
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
Definition chsv.h:16

References brightness, fl::clamp(), inoise16(), leds, ledsScale(), mapCorkScrew, NUM_LEDS, pos, x, y, and z.

Referenced by loop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: