Need help getting rid of delays and using millis() instead

I am working on a project and I need some LEDs to turn on and off in a cycle. I am currently using delays to do this task, but I also need to be able to read button presses while the LEDs are going through the cycle so I need to use millis instead. Can anyone help me with what the equivalent code for this would, using millis() (no delays)? Please explain the logic behind it as well! I've already looked at the "Blink Without Delay" tutorial and it didn't really help me out much.

  digitalWrite(bluePin1, LOW);
  digitalWrite(yellowPin1, HIGH);

  digitalWrite(yellowPin1, LOW);
  digitalWrite(greenPin1, HIGH);
  digitalWrite(greenPin1, LOW);
  digitalWrite(bluePin1, HIGH);
const byte bluePin = 2;
const byte yellowPin = 3;
const byte greenPin = 4;
const byte led[] = { yellowPin, greenPin, bluePin };
const unsigned int duration[] = { 7000, 2000, 3000 };
byte state;
unsigned long lastTransition;

void setup() {
  pinMode(bluePin, OUTPUT);
  pinMode(yellowPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  digitalWrite(led[state], HIGH);

void loop() {
  unsigned long topLoop = millis();
  if (topLoop - lastTransition >= duration[state]) {
    digitalWrite(led[state], LOW);
    lastTransition = topLoop;
    if (++state >= sizeof(led)) {
      state = 0;
    digitalWrite(led[state], HIGH);

The demo Several Things at a Time is an extended example of BWoD. It may help with understanding the technique.