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

◆ draw()

void draw ( uint32_t now)

Definition at line 77 of file FxNoiseRing.ino.

77 {
78 double angle_offset = double(now) / 32000.0 * 2 * M_PI;
79 now = (now << timeBitshift.as<int>()) * timescale.as<double>();
80 // go in circular formation and set the leds
81 for (int i = 0; i < NUM_LEDS; i++) {
82 float angle = i * 2 * M_PI / NUM_LEDS + angle_offset;
83 float x = cos(angle);
84 float y = sin(angle);
85 x *= 0xffff * scale.as<double>();
86 y *= 0xffff * scale.as<double>();
87 uint16_t noise = inoise16(x, y, now);
88 uint16_t noise2 = inoise16(x, y, 0xfff + now);
89 uint16_t noise3 = inoise16(x, y, 0xffff + now);
90 noise3 = noise3 >> 8;
91 int16_t noise4 = map(noise3, 0, 255, -64, 255);
92 if (noise4 < 0) {
93 noise4 = 0;
94 }
95 leds[i] = CHSV(noise >> 8, MAX(128, noise2 >> 8), noise4);
96 }
97}
CRGB leds[NUM_LEDS]
Definition Apa102.ino:11
#define NUM_LEDS
Definition Apa102.ino:6
uint8_t noise[NUM_LAYERS][WIDTH][HEIGHT]
Definition Fire2023.ino:86
uint32_t x[NUM_LAYERS]
Definition Fire2023.ino:80
uint8_t noise2[NUM_LAYERS][WIDTH][HEIGHT]
Definition Fire2023.ino:87
uint32_t y[NUM_LAYERS]
Definition Fire2023.ino:81
UISlider scale("Scale", 4,.1, 4,.1)
UISlider timescale("Time Scale", 1,.1, 10,.1)
UISlider timeBitshift("Time Bitshift", 5, 0, 16, 1)
#define MAX(a, b)
Definition math_macros.h:4
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:466
long map(long x, long in_min, long in_max, long out_min, long out_max)
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
Definition chsv.h:16

References inoise16(), leds, MAX, noise, noise2, NUM_LEDS, scale, timeBitshift, timescale, x, and y.

Referenced by loop().

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