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

◆ showGenerative()

void showGenerative ( uint32_t now)

Definition at line 192 of file old.h.

192 {
193 // This function is called to show the generative pattern
194 for (int i = 0; i < NUM_LEDS; i++) {
195 // Get the 2D position of this LED from the screen map
197 float x = pos.x;
198 float y = pos.y;
199 float z = pos.z;
200
201 x*= 20.0f * ledsScale.value();
202 y*= 20.0f * ledsScale.value();
203 z*= 20.0f * ledsScale.value();
204
205 uint16_t noise_value = inoise16(x,y,z, now / 100);
206 // Normalize the noise value to 0-255
207 uint8_t brightness = map(noise_value, 0, 65535, 0, 255);
208 // Create a hue that changes with position and time
209 uint8_t sat = int32_t((x * 10 + y * 5 + now / 5)) % 256;
210 // Set the color
211 leds[i] = CHSV(170, sat, fl::clamp(255- sat, 64, 255));
212 }
213}
CRGB leds[NUM_LEDS]
#define NUM_LEDS
int y
Definition simple.h:93
int x
Definition simple.h:92
uint8_t pos
Definition Blur.ino:11
uint32_t z[NUM_LAYERS]
Definition Fire2023.h:94
UISlider brightness("Brightness", 128, 0, 255, 1)
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:420
FASTLED_FORCE_INLINE T clamp(T value, T min, T max)
Definition clamp.h:10
vec3< float > vec3f
Definition geometry.h:185
UISlider ledsScale("Leds scale", 0.1f, 0.1f, 1.0f, 0.01f)
fl::vector< vec3f > mapCorkScrew
Definition old.h:151
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
Definition hsv.h:15

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: