flux capacitor help

I am having trouble understanding how to operate two different functions on my project. I am attempting to build a fairly accurate replica of the flux capacitor from Back to the Future for my son.

Here is a video of the flux capacitor I am building:

In the acrylic blocks there are four white leds that are running in a chase pattern. Here is the sketch I am using for the chase pattern:

int timer = 40

; // The higher the number, the slower the timing.

void setup() {
// use a for loop to initialize each pin as an output:
for (int thisPin = 2; thisPin < 6; thisPin++) {
pinMode(thisPin, OUTPUT);

void loop() {
// loop from the lowest pin to the highest:
for (int thisPin = 2; thisPin < 6; thisPin++) {
// turn the pin on:
digitalWrite(thisPin, HIGH);
// turn the pin off:
digitalWrite(thisPin, LOW);


I also have a few blue leds in the acrylic blocks and in the four corners of the board the acrylic blocks are mounted to. the white leds are hooked up to pins 2,3,4 and 5. The blue leds in the blocks are all hooked together can be plugged into any open pin. There are also four blue leds in each corner of the board which can be plugged into any open pin. What I would like to do is have the chase pattern run continuously until a momentary button on the side of the case is pressed (replicates the Delorean reaching 88 mph) causing the blue lights and white lights to fade on and off a few times fairly quickly then back to the chase pattern of only white. I am interested in learning the programing but can’t wrap my head around a simple way to do it. I have been searching for hours but am just getting more confused. All tips and advice will be appreciated. Thanks

Rather then running a full cycle of the animation every time through loop() you should use global variables to keep track of where you are in the animation. Study the BlinkWithoutDelay example to see how to add time delays between steps. This way the loop() function can repeat much faster and you can make the button more responsive.