Seeking Advice on a 3 Button-State Mini-Project

So me and a friend are in a lab together, and we are working on a mini-project. The project involves creating and programming a circuit that can cycle through three button-states. The states are as follows:

State 0:
Use the analogWrite command on pins 9 through 11 so Red, Green and Blue LEDs are set to a pulse width modulation (PWM) of 5.

State 1:
After the button is pressed for the first time, the LEDs are to follow a pattern described in Table 1. Use PWM to set the intensity.

State 2:
When the button is pressed the second time, all three lights will follow a pattern described in Table 2. When the intensity is to increase, colors decrease from 255 to 0 every 10 msec following a nonlinear increase of intensity calculated using Equation 1.

State 0:
After the third button press, the lights should return to State 0. With each successive button press, the lights should step from one state to the next.

The circuit we have, as well as the code we have cobbled together, are attached below. Our issue is that we can (usually) get State 0 to work, but we can’t get our code and circuit to go to the next state or even reliably just show State 0. We’ve consulted the Interwebs and various resources at our university, but we can’t figure out. Any advice would be greatly appreciated. Thanks.

Mini_Project.ino (1.64 KB)

If you post your code, in code tags, more members can see it.

In the Arduino IDE, press Ctrl+T now and then.

You do not need to know if the button is pressed, only the moment (the event) that it changes from "not pressed" to "pressed". That is the State Change Detection example:
I do not see that in your sketch.

The are three states, 0, 1 and 2. I don't see that in the sketch. At least explain in comments which part of the sketch is for which state. A variable 'state' could be used, so you know in what state the sketch is in.

I suggest to use only PWM with analogWrite() for the RGB pins and not mix that with digitalWrite().
The analogWrite(0) is guaranteed to be always off.
The analogWrite(255) is guaranteed to be always on.

Avoid a 'while' in the loop(). Let the loop() run over and over again very fast and use that.

At this moment it is not important what the result is and if the led is blinking or not. You need first to think about the structure of the code. It has three states, so that is the main structure. Then you have to read a button somewhere and check if it was pressed. That is typical for the begin of the loop() function. In between the states and the buttons is the part that processes the button clicks and changes the state.