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

◆ triggerRipple()

void triggerRipple ( )

Definition at line 147 of file wavefx.cpp.

147 {
148 // Define a margin percentage to keep ripples away from the edges
149 float perc = .15f;
150
151 // Calculate the boundaries for the ripple (15% from each edge)
152 uint8_t min_x = perc * WIDTH; // Left boundary
153 uint8_t max_x = (1 - perc) * WIDTH; // Right boundary
154 uint8_t min_y = perc * HEIGHT; // Top boundary
155 uint8_t max_y = (1 - perc) * HEIGHT; // Bottom boundary
156
157 // Generate a random position within these boundaries
158 int x = random(min_x, max_x);
159 int y = random(min_y, max_y);
160
161 // Set a wave peak at this position in both wave layers
162 // The value 1.0 represents the maximum height of the wave
163 waveFxLower.setf(x, y, 1); // Create ripple in lower layer
164 waveFxUpper.setf(x, y, 1); // Create ripple in upper layer
165}
#define WIDTH
Definition Blur2d.ino:9
#define HEIGHT
Definition Blur2d.ino:10
uint32_t x[NUM_LAYERS]
Definition Fire2023.ino:82
uint32_t y[NUM_LAYERS]
Definition Fire2023.ino:83
WaveFx waveFxLower(xyRect, CreateArgsLower())
WaveFx waveFxUpper(xyRect, CreateArgsUpper())

References HEIGHT, waveFxLower, waveFxUpper, WIDTH, x, and y.

Referenced by loop(), processAutoTrigger(), and wavefx_loop().

+ Here is the caller graph for this function: