4 digits 7s display + 74HC595

void loop(){
currentMillis = millis(); // all time elements are type unsigned long
elapsedMillis = currentMillis - previousMillis;
if (elapsedMillis >= duration){
previousMillis = previousMillis + duration;
indexCount = indexCount +1;
if (indexCount == 4){ indexCount = 0;}
PORTD =  PORTD & 0b00001111; // clear D4,5,6,7, used for digit select NPNs
digitalWrite (ssPin, LOW);
SPI.transfer (anodeArray[x]);
digitalWrite (ssPin, HIGH); //
PORTD = PORTD | cathodeArray[x]; // OR in walking 1 pattern, leave D0-1-2-3 unchanged
} // end time check
// do other stuff
} // end loop
byte cathodeArray[] = {
0b00010000, // walking 1 pattern for cathode drivers
0b00100000,
0b01000000,
0b10000000,
};

See if you can follow that. SPI for the anode shift register, D4-5-6-7 for the cathodes.