| 189 | |
| 190 | |
| 191 | void showGenerative(uint32_t now) { |
| 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 |
| 195 | fl::vec3f pos = mapCorkScrew[i]; |
| 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 | } |
| 213 | |
| 214 | void loop() { |
| 215 | uint32_t now = millis(); |