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

◆ triggerRipple()

void triggerRipple ( )

Definition at line 146 of file wavefx.cpp.

146 {
147 // Define a margin percentage to keep ripples away from the edges
148 float perc = .15f;
149
150 // Calculate the boundaries for the ripple (15% from each edge)
151 uint8_t min_x = perc * WIDTH; // Left boundary
152 uint8_t max_x = (1 - perc) * WIDTH; // Right boundary
153 uint8_t min_y = perc * HEIGHT; // Top boundary
154 uint8_t max_y = (1 - perc) * HEIGHT; // Bottom boundary
155
156 // Generate a random position within these boundaries
157 int x = random(min_x, max_x);
158 int y = random(min_y, max_y);
159
160 // Set a wave peak at this position in both wave layers
161 // The value 1.0 represents the maximum height of the wave
162 waveFxLower.setf(x, y, 1); // Create ripple in lower layer
163 waveFxUpper.setf(x, y, 1); // Create ripple in upper layer
164}
int y
Definition Audio.ino:72
#define WIDTH
Definition Audio.ino:33
int x
Definition Audio.ino:71
#define HEIGHT
Definition Audio.ino:32
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: