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

◆ showGenerative()

void showGenerative ( uint32_t now)

Definition at line 191 of file old.h.

191 {
192 // This function is called to show the generative pattern
193 for (int i = 0; i < NUM_LEDS; i++) {
194 // Get the 2D position of this LED from the screen map
196 float x = pos.x;
197 float y = pos.y;
198 float z = pos.z;
199
200 x*= 20.0f * ledsScale.value();
201 y*= 20.0f * ledsScale.value();
202 z*= 20.0f * ledsScale.value();
203
204 uint16_t noise_value = inoise16(x,y,z, now / 100);
205 // Normalize the noise value to 0-255
206 uint8_t brightness = map(noise_value, 0, 65535, 0, 255);
207 // Create a hue that changes with position and time
208 uint8_t sat = int32_t((x * 10 + y * 5 + now / 5)) % 256;
209 // Set the color
210 leds[i] = fl::CHSV(170, sat, fl::clamp(255- sat, 64, 255));
211 }
212}
#define NUM_LEDS
fl::CRGB leds[NUM_LEDS]
fl::UISlider brightness("Brightness", BRIGHTNESS, 0, 255)
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:93
fl::u16 inoise16(fl::u32 x, fl::u32 y, fl::u32 z, fl::u32 t)
fl::u16 uint16_t
Definition s16x16x4.h:214
MapRedBlackTree< Key, T, Compare, fl::allocator_slab< char > > map
Definition map.h:283
vec3< float > vec3f
Definition geometry.h:185
fl::i32 int32_t
Definition s16x16x4.h:220
constexpr enable_if< is_fixed_point< T >::value, T >::type clamp(T x, T lo, T hi) FL_NOEXCEPT
unsigned char uint8_t
Definition s16x16x4.h:209
fl::vector< vec3f > mapCorkScrew
Definition old.h:150
fl::UISlider ledsScale("Leds scale", 0.1f, 0.1f, 1.0f, 0.01f)

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: