Remove delay from function

Hi,
I am controlling some leds by PWM through a transistor and that works fine.
I have two led modes and pushing a button switches between the two modes.
One mode however uses a delay and I want to re make the function without the delay by using millis().

Here is my full code.

/*
PWN Led's with a transistor. 
A transistor is needed because more than 2 LEDs draw too much current for an Arduino pin. Here we have 4 LEDs drawing 20 mA each.
Each Arduino pin can handle 40 mA of current.  A seperate power supply is also needed.
 */

int ledPinA = 5;
int i=0;
int s=1;
int buttonPin = 2;
int ledPin =  7;
int buttonState = 0; 
int ledState=1;// 1 = Glow, 2 = Pulse
long previousMillis = 0;
long interval = 100;

void setup() 
{
  Serial.begin(9600);
  pinMode(ledPinA, OUTPUT);        
  pinMode(ledPin,OUTPUT);
  attachInterrupt(0, blink, CHANGE); // pushbutton switch connected to pin 2
}

void loop()
{
  switch (ledState) {
    case 1:
      lightGlow();
      break;
    case 2:
      lightPulse();
      break;
  }
}

void lightGlow()
{
 Serial.println("Glow ");
 digitalWrite(ledPinA, HIGH);   
}

void lightPulse()
{
 Serial.println("Pulse ");
 for (i=0; i<255; i++)
 {
  analogWrite(ledPinA, 255-i); 
  delay(100);  
 }
 for (i=0; i<255; i++)
 {
  analogWrite(ledPinA, i); 
  delay(100);  
 }
}
void lightPulse2()
{
 Serial.println("Pulse ");
 unsigned long currentMillis = millis();
 if(currentMillis - previousMillis > interval) 
   {
    previousMillis = currentMillis;   
    i++;
	} 
 if (i>=255 && s==1)
 {
	 s=0;
	 i=0;
 }
 else if (i>=255)
 {
	 s=1;
	 i=0;
 }
 
 if (s==0)
 {
	analogWrite(ledPinA, 255-i);
 }
  if (s==1)
 {
     analogWrite(ledPinA, i);
 }  
}


void blink()
{
if (ledState == 2) 
  {       
    digitalWrite(ledPin, LOW);  
    ledState=1; //Pulse mode
  }
  else 
  {
    digitalWrite(ledPin, HIGH);
    ledState=2; //Glow mode
  }
}

void buttonRead()
{
  buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) 
{       
    digitalWrite(ledPin, HIGH);  
    ledState=2; //Pulse mode
  }
  else 
  {
    digitalWrite(ledPin, LOW);
    ledState=1; //Glow mode
  }
  switch (ledState) 
  {
    case 1:
      lightGlow();
      break;
    case 2:
      lightPulse();
      break;
  }

}

Here is my function with the delay. This works fine expect I want it without the delay.

void lightPulse()
{
 Serial.println("Pulse ");
 for (i=0; i<250; i++)
 {
  analogWrite(ledPinA, 255-i); 
  delay(100);  
 }
 for (i=5; i<255; i++)
 {
  analogWrite(ledPinA, i); 
  delay(100);  
 }
}

Here is my attempt to make it without the delay. I have not actually tested this yet.

void lightPulse2()
{
 Serial.println("Pulse ");
 unsigned long currentMillis = millis();
 if(currentMillis - previousMillis > interval) 
   {
    previousMillis = currentMillis;   
    i++;
	} 
 if (i>=255 && s==1)
 {
	 s=0;
	 i=0;
 }
 else if (i>=255)
 {
	 s=1;
	 i=0;
 }
 
 if (s==0)
 {
	analogWrite(ledPinA, 255-i);
 }
  if (s==1)
 {
     analogWrite(ledPinA, i);
 }  
}

Will this work? How would I make it better / more simplified?
Thanks.

Here's a simpler version:

void lightPulse3()
{
static int increment=1;
Serial.println("Pulse ");
unsigned long currentMillis = millis();
if(currentMillis - previousMillis > interval) 
  {
  previousMillis = currentMillis;   
  i+=increment;
  if ((i>249) || (i<6))
    {
    increment *= -1;
    }
  analogWrite(ledPinA, i);
  }
}

compiled, not tested

What to think of using the timer2 library - Arduino Playground - MsTimer2 - to call this function every 100ms

void lightPulse()
{
  stativ int brightness = 0;
  static int delta = +1;

  analogWrite(ledPinA, brightness); 
  brightness += delta;
 
  if (brightness == 0 || brightness == 255) delta = - delta;
 }

Thanks for the suggestions .
I like the idea of calling the function once every 100 miliseconds.
I hadn't that of that but will give both a try when I have a second.

Ok, this seems to be working, but now I need help controlling my button.
I have an arcade style momentary button.

What is the proper way to hook it up?
Currently I have the one lead hooked to ground and one of the other leads connected to 5 volts with a 10k resistor connecting to the line controlling the transistor.
Pushing the button make everything go off momentarily, like I'm pressing the reset button on the Arduino.

Currently I have the one lead hooked to ground and one of the other leads connected to 5 volts with a 10k resistor connecting to the line controlling the transistor

Now I might be reading this wrong... but...

You have one side of your button connected to ground, and the other side connected to 5V?
Or you have one side connected to ground, and the other side to a 10k resistor, the other side of the 10k resistor is then connected to 5V?

two very different scenarios...
the first one is a direct short circuit... so yes, the arduino will 'turn off'

just looked at the push button, its a 3 terminal... that makes more sense, but still...

Please elaborate... especially the bit about 'one of the other leads' - I assume you dont have 5V to common, and GND to N/O or something...
If you have a drawing of what you have done that will help too.

Thanks, I think I've got it now. Here is my setup. Basically I'm ignoring the first pin on the button.
I had a 10k resistor instead of the 1k I have now. So far it is working.

|-----------------
|
Button| -------------- +5V
|
|------------^^^^ 1K ^^^------- gnd
|
|
to arduino pin

You could also just wire the button to arduino pin & gnd, and use the internal pullups.
What you have is probably good if you have longi wires connected.

Thanks CrossRoads.
My final wiring may be between a foot and a foot and a half long.
I like your idea, no external resistor needed.