Create a ripple effect at a random position within the central area of the display
| 153 | |
| 154 | // Create a ripple effect at a random position within the central area of the display |
| 155 | void triggerRipple() { |
| 156 | // Define a margin percentage to keep ripples away from the edges |
| 157 | float perc = .15f; |
| 158 | |
| 159 | // Calculate the boundaries for the ripple (15% from each edge) |
| 160 | uint8_t min_x = perc * WIDTH; // Left boundary |
| 161 | uint8_t max_x = (1 - perc) * WIDTH; // Right boundary |
| 162 | uint8_t min_y = perc * HEIGHT; // Top boundary |
| 163 | uint8_t max_y = (1 - perc) * HEIGHT; // Bottom boundary |
| 164 | |
| 165 | // Generate a random position within these boundaries |
| 166 | int x = random(min_x, max_x); |
| 167 | int y = random(min_y, max_y); |
| 168 | |
| 169 | // Set a wave peak at this position in both wave layers |
| 170 | // The value 1.0 represents the maximum height of the wave |
| 171 | waveFxLower.setf(x, y, 1); // Create ripple in lower layer |
| 172 | waveFxUpper.setf(x, y, 1); // Create ripple in upper layer |
| 173 | } |
| 174 | |
| 175 | // Create a fancy cross-shaped effect that expands from the center |
| 176 | void applyFancyEffect(uint32_t now, bool button_active) { |
no test coverage detected