How to Shift registers without delay

Hello,
i'm trying to make some kind of home domatica, now i want this piece of code insert in a big sketch. The problem is that this piece of code make use of delay. Now i'm trying to replace the delay with millis but what erver i try the only thing happens is that the leds stay on. If i put back the delay everthing work fine.

I read a lot of topics on this site but i can find the right answer. Can someone explain or put me in the right direction so i can replace the delay for a non blocking code ?

thank you for helping and sorry for my bad english

int latchPin = 8;
int dataPin = 13;
int clockPin = 12;

//int waitFor = 500;

int first = 0; 
int second = 0;
int third = 0;
int fourth = 0;
int fifth = 0;

unsigned long lightLedsChecked = 0;
unsigned long lightLedsCheckIinterval = 500; // 30 sec      // interval at which to blink (milliseconds)

void setup() {
 
 pinMode (dataPin, OUTPUT);
 pinMode (clockPin, OUTPUT);
 pinMode (latchPin, OUTPUT);
}

void loop() {
 unsigned long now = millis();
lightLeds (0b00000001, 0b10000000, 0b10000100, 0b00000010, 0b00011000); 
lightLeds (0b00000011, 0b11000000, 0b10000100, 0b00000010, 0b00011100);
lightLeds (0b00000111, 0b11100000, 0b10000100, 0b00000010, 0b00011110);
lightLeds (0b00001111, 0b11110000, 0b10000100, 0b00000010, 0b00011111);
lightLeds (0b00011111, 0b11111000, 0b10000100, 0b00000010, 0b00010111);
lightLeds (0b00111111, 0b11111100, 0b10000100, 0b00000010, 0b00010011);
lightLeds (0b01111111, 0b11111110, 0b10000100, 0b00000010, 0b00010001);
lightLeds (0b11111111, 0b11111111, 0b10000100, 0b00000010, 0b00010000);
lightLeds (0b00111111, 0b11111100, 0b10000100, 0b00000010, 0b00010101);
lightLeds (0b00001111, 0b11110000, 0b10000100, 0b00000010, 0b00011010);
lightLeds (0b00000011, 0b11000000, 0b10000100, 0b00000010, 0b00010101);
lightLeds (0b00000000, 0b00000001, 0b00000000, 0b00000000, 0b00011010);
lightLeds (0b00000000, 0b00000110, 0b00000000, 0b00000000, 0b00110101);
lightLeds (0b00000000, 0b00001110, 0b00000000, 0b00000000, 0b01101010);
lightLeds (0b00000000, 0b00011100, 0b00000000, 0b00000000, 0b11000101);
lightLeds (0b00000000, 0b00111000, 0b00000000, 0b00000001, 0b10001010);
lightLeds (0b00000000, 0b01110000, 0b00000000, 0b00000011, 0b00000101);
lightLeds (0b00000000, 0b11100000, 0b00000000, 0b00000110, 0b00001100);
lightLeds (0b00000001, 0b11000000, 0b00000000, 0b00001100, 0b00000011);
lightLeds (0b00000011, 0b10000000, 0b00000000, 0b00011000, 0b00001100);
lightLeds (0b00000111, 0b00000000, 0b00000000, 0b00110000, 0b00000011);
lightLeds (0b00001110, 0b00000000, 0b00000000, 0b01100000, 0b00000000);
lightLeds (0b00011100, 0b00000000, 0b00000000, 0b11000000, 0b00001111);
lightLeds (0b00111000, 0b00000000, 0b00000001, 0b10000000, 0b00000000);
lightLeds (0b01110000, 0b00000000, 0b00000011, 0b00000000, 0b00001111);
lightLeds (0b11100000, 0b00000000, 0b00000110, 0b00000000, 0b00000000);
lightLeds (0b11000000, 0b00000000, 0b00001100, 0b00000000, 0b00001111);
lightLeds (0b10000000, 0b00000000, 0b00011000, 0b00000000, 0b00000000);
lightLeds (0b10100000, 0b00000101, 0b00110000, 0b00000000, 0b00001111);
lightLeds (0b11010000, 0b00001011, 0b01100000, 0b00000000, 0b00000111);
lightLeds (0b11101000, 0b00010111, 0b11000000, 0b00000000, 0b00000011);
lightLeds (0b11110100, 0b00101111, 0b10000000, 0b00000000, 0b00000001);
lightLeds (0b11111101, 0b10111111, 0b11111000, 0b00000000, 0b00000110);
lightLeds (0b00011100, 0b10111000, 0b11111111, 0b11000000, 0b00001001);
lightLeds (0b00000101, 0b10100000, 0b11111111, 0b11111110, 0b00000110);
lightLeds (0b00000001, 0b10000000, 0b11111111, 0b11111111, 0b11111001);
lightLeds (0b10101010, 0b10101010, 0b10101010, 0b10101010, 0b10101010);
lightLeds (0b01010101, 0b01010101, 0b01010101, 0b01010101, 0b01010101);
lightLeds (0b10101010, 0b10101010, 0b10101010, 0b10101010, 0b10101010);
lightLeds (0b11001100, 0b11001100, 0b11001100, 0b11001100, 0b11001100);
lightLeds (0b00110011, 0b00110011, 0b00110011, 0b00110011, 0b00110011);
lightLeds (0b11001100, 0b11001100, 0b11001100, 0b11001100, 0b11001100);
lightLeds (0b11101110, 0b11101110, 0b11111100, 0b00000000, 0b00000000);
lightLeds (0b01110111, 0b01110111, 0b11111111, 0b11111100, 0b00001111);
lightLeds (0b11101110, 0b11101110, 0b11111111, 0b11111111, 0b11110111);
lightLeds (0b11111111, 0b11111111, 0b11111100, 0b00000011, 0b11110011);
lightLeds (0b11111111, 0b11111111, 0b00000011, 0b11111100, 0b00000001);
lightLeds (0b11111111, 0b11111111, 0b11111100, 0b00000011, 0b11111111);
lightLeds (0b11111111, 0b11111111, 0b11111111, 0b11111111, 0b11111111);

if(now - lightLedsChecked >= lightLedsCheckIinterval)
  {
     lightLeds(0,0,0,0,0);
  } 
}

void lightLeds (int fifth, int fourth, int third, int second, int first)  
{
 
 shiftOut (dataPin, clockPin, LSBFIRST, first);
 shiftOut (dataPin, clockPin, LSBFIRST, second);
 shiftOut (dataPin, clockPin, LSBFIRST, third);
 shiftOut (dataPin, clockPin, LSBFIRST, fourth);
 shiftOut (dataPin, clockPin, LSBFIRST, fifth);
 digitalWrite (latchPin, HIGH);
 digitalWrite (latchPin, LOW);
lightLedsChecked= millis();
}

where are you trying to delay()? Between each call to lightLeds()? If so, you want to save your patterns in an array and check the elapsed time inside of loop() and if the interval has been exceeded, move on to the nest pattern. Something like this:

int latchPin = 8;
int dataPin = 13;
int clockPin = 12;

unsigned long lightLedsChecked = 0;
const unsigned long lightLedsCheckIinterval = 500; // 30 sec      // interval at which to blink (milliseconds)

const byte patterns[][5] = {
  {0b00000001, 0b10000000, 0b10000100, 0b00000010, 0b00011000},
  {0b00000011, 0b11000000, 0b10000100, 0b00000010, 0b00011100},
  {0b00000111, 0b11100000, 0b10000100, 0b00000010, 0b00011110},
  {0b00001111, 0b11110000, 0b10000100, 0b00000010, 0b00011111},
  {0b00011111, 0b11111000, 0b10000100, 0b00000010, 0b00010111},
  {0b00111111, 0b11111100, 0b10000100, 0b00000010, 0b00010011},
  {0b01111111, 0b11111110, 0b10000100, 0b00000010, 0b00010001},
  {0b11111111, 0b11111111, 0b10000100, 0b00000010, 0b00010000},
  {0b00111111, 0b11111100, 0b10000100, 0b00000010, 0b00010101},
  {0b00001111, 0b11110000, 0b10000100, 0b00000010, 0b00011010},
  {0b00000011, 0b11000000, 0b10000100, 0b00000010, 0b00010101},
  {0b00000000, 0b00000001, 0b00000000, 0b00000000, 0b00011010},
  {0b00000000, 0b00000110, 0b00000000, 0b00000000, 0b00110101},
  {0b00000000, 0b00001110, 0b00000000, 0b00000000, 0b01101010},
  {0b00000000, 0b00011100, 0b00000000, 0b00000000, 0b11000101},
  {0b00000000, 0b00111000, 0b00000000, 0b00000001, 0b10001010},
  {0b00000000, 0b01110000, 0b00000000, 0b00000011, 0b00000101},
  {0b00000000, 0b11100000, 0b00000000, 0b00000110, 0b00001100},
  {0b00000001, 0b11000000, 0b00000000, 0b00001100, 0b00000011},
  {0b00000011, 0b10000000, 0b00000000, 0b00011000, 0b00001100},
  {0b00000111, 0b00000000, 0b00000000, 0b00110000, 0b00000011},
  {0b00001110, 0b00000000, 0b00000000, 0b01100000, 0b00000000},
  {0b00011100, 0b00000000, 0b00000000, 0b11000000, 0b00001111},
  {0b00111000, 0b00000000, 0b00000001, 0b10000000, 0b00000000},
  {0b01110000, 0b00000000, 0b00000011, 0b00000000, 0b00001111},
  {0b11100000, 0b00000000, 0b00000110, 0b00000000, 0b00000000},
  {0b11000000, 0b00000000, 0b00001100, 0b00000000, 0b00001111},
  {0b10000000, 0b00000000, 0b00011000, 0b00000000, 0b00000000},
  {0b10100000, 0b00000101, 0b00110000, 0b00000000, 0b00001111},
  {0b11010000, 0b00001011, 0b01100000, 0b00000000, 0b00000111},
  {0b11101000, 0b00010111, 0b11000000, 0b00000000, 0b00000011},
  {0b11110100, 0b00101111, 0b10000000, 0b00000000, 0b00000001},
  {0b11111101, 0b10111111, 0b11111000, 0b00000000, 0b00000110},
  {0b00011100, 0b10111000, 0b11111111, 0b11000000, 0b00001001},
  {0b00000101, 0b10100000, 0b11111111, 0b11111110, 0b00000110},
  {0b00000001, 0b10000000, 0b11111111, 0b11111111, 0b11111001},
  {0b10101010, 0b10101010, 0b10101010, 0b10101010, 0b10101010},
  {0b01010101, 0b01010101, 0b01010101, 0b01010101, 0b01010101},
  {0b10101010, 0b10101010, 0b10101010, 0b10101010, 0b10101010},
  {0b11001100, 0b11001100, 0b11001100, 0b11001100, 0b11001100},
  {0b00110011, 0b00110011, 0b00110011, 0b00110011, 0b00110011},
  {0b11001100, 0b11001100, 0b11001100, 0b11001100, 0b11001100},
  {0b11101110, 0b11101110, 0b11111100, 0b00000000, 0b00000000},
  {0b01110111, 0b01110111, 0b11111111, 0b11111100, 0b00001111},
  {0b11101110, 0b11101110, 0b11111111, 0b11111111, 0b11110111},
  {0b11111111, 0b11111111, 0b11111100, 0b00000011, 0b11110011},
  {0b11111111, 0b11111111, 0b00000011, 0b11111100, 0b00000001},
  {0b11111111, 0b11111111, 0b11111100, 0b00000011, 0b11111111},
  {0b11111111, 0b11111111, 0b11111111, 0b11111111, 0b11111111},
};

const int nPatterns = sizeof(patterns) / sizeof(patterns[0]);
int currentPattern = 0;

void setup() {

  pinMode (dataPin, OUTPUT);
  pinMode (clockPin, OUTPUT);
  pinMode (latchPin, OUTPUT);
  lightLeds( currentPattern );
}

void loop() {
  unsigned long now = millis();

  if (now - lightLedsChecked >= lightLedsCheckIinterval)
  {
    currentPattern++;
    if ( currentPattern >= nPatterns ) {
      currentPattern = 0;
    }
    lightLeds(currentPattern);
  }
}

void lightLeds (int index )
{
  shiftOut (dataPin, clockPin, LSBFIRST, patterns[index][0]);
  shiftOut (dataPin, clockPin, LSBFIRST, patterns[index][1]);
  shiftOut (dataPin, clockPin, LSBFIRST, patterns[index][2]);
  shiftOut (dataPin, clockPin, LSBFIRST, patterns[index][3]);
  shiftOut (dataPin, clockPin, LSBFIRST, patterns[index][4]);
  digitalWrite (latchPin, HIGH);
  digitalWrite (latchPin, LOW);
  lightLedsChecked = millis();
}

Thank you verry much for helping. This is what i looking for.