HELP!! Breaking out of a loop using a button

I am trying to break out of a 5 LED fading loop using a push button.

When the button is pressed I want the Fading LEDS to go to 255 and stay there

When the button is pressed again i want the LEDS to go back to the fading loop.

I'm not quit sure how to add a switch case statement into my sketch of even if that's the best was to achieve what I'm trying to accomplish

any and all hep will be greatly appreciated. Thank you all

#include <Curve.h>
#include <LEDFader.h>


#/*
Fades 5 LEDs, all to random PWM values and durations.
This uses all the PWM pins on the UNO board.
Circuit
-------
* Connect the anode (flat side/long leg) of each LED to one of the PWM pins listed below on the arduino, via a 220 ohm resistor.
* Connect the cathode (short leg) of each LED to ground.
* PWM Pins on the UNO board:
- 3
- 5
- 6
- 9
- 10
- 11
RGB LEDs
--------
You can also use this code with 2 RGB LEDs. This will fade each of the colors on an off at
random durations and intensities. Check the LED datasheet to see if it's a common cathode or anode and
which legs are which.
For common anode RGB LEDs, attach the anode to ground and each cathode leg to a PWM pin through a
resistor.
For common cathode RGB LEDs, the cathode will be connected straight to 5+ and each
of the anode legs will be connected to a PWM pin through a resistor. Since you're basically attaching
the ground pins to the arduino, the brightness values are reversed: 0 is 100% and 255 is completely off.
This is called current sinking.
*/
#define LED_NUM 5
// 5 LEDs 
LEDFader leds[LED_NUM] = {
LEDFader(3),
LEDFader(5),
LEDFader(6),
LEDFader(9),
LEDFader(10),

};
void setup() {
}
void loop() {
// Update all LEDs and start new fades if any are done
for (byte i = 0; i < LED_NUM; i++) {
LEDFader *led = &leds[i];
led->update();
// Set new fade
if (led->is_fading() == false) {
int duration = random(1000, 3000); // between 1 - 3 seconds
// Up
if (led->get_value() == 0) {
byte color = random(100, 255);
led->fade(color, duration);
}
// Down
else {
led->fade(0, duration);
}
}
}
}

Your code is unreadable!

Your code is very poorly formatted - actually it is not formatted at all.

I could only read it by copying it to my editor and formatting it properly. If it was any longer I would not have bothered. The Arduino IDE has an Auto-Format option - use it.

Without knowing how your fader lbrary works I can't answer your question. The main issue is whether the library blocks everything until the fading is complete.

If you look at the demo several things at a time you will see how a button can be read while other things are happening. It may be possible to modify your program to emulate that. It would certainly be possible to modify the demo to make LEDs fade rather than flash.

...R