You have two choices. The first is to scrap all that code and start over. The loop() function loops. Let it handle all the looping. On any given pass through loop(), it may, or may not, be time to do something (such as change pixel number, etc.) or it may not.
You can, then, read the switch on every pass through loop(), resulting in nearly instantaneous recognition of switch presses.
Or, you can continue with that poor structure, and add poll the switch on every pass through every for loop, and break out of the for loop when the switch is pressed.