how to make "for" loops for a specific time, e.g. 30 sec

Dear Colleagues
One again as a beginner arduino code fan i work on my ws2812 LEDs.
Could You advice how to loops spec time control structure “for” e.g. 30 sec

for(int i=0; i<NUMPIXELS; i++)
  { 
   pixels.setPixelColor(i, pixels.Color(255, 0, 0));
    pixels.show();
  }

Full code:

#include <Adafruit_NeoPixel.h>


// Which pin on the Arduino is connected to the NeoPixels?
#define PIN        3 // On Trinket or Gemma, suggest changing this to 1

// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 8 // Popular NeoPixel ring size

// When setting up the NeoPixel library, we tell it how many pixels,
// and which pin to use to send signals. Note that for older NeoPixel
// strips you might need to change the third parameter -- see the
// strandtest example for more information on possible values.
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

#define DELAYVAL 500 // Time (in milliseconds) to pause between pixels

void setup() {
  // These lines are specifically to support the Adafruit Trinket 5V 16 MHz.
  // Any other board, you can remove this part (but no harm leaving it):
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
  clock_prescale_set(clock_div_1);
#endif
  // END of Trinket-specific code.

  pixels.begin();
  pixels.show();// INITIALIZE NeoPixel strip object (REQUIRED)
  pixels.setBrightness(50);
}


void loop() {
  pixels.clear(); // Set all pixel colors to 'off'

   delay(DELAYVAL);
  for(int i=0; i<NUMPIXELS; i++)
  { 
   pixels.setPixelColor(i, pixels.Color(255, 0, 0));
    pixels.show();
  }
    delay(DELAYVAL);
    for(int i=0; i<NUMPIXELS; i++) 
    {
    pixels.setPixelColor(i, pixels.Color(0, 0, 0));
    pixels.show(); 
    }
     delay(DELAYVAL);
    for(int i=0; i<NUMPIXELS; i++) 
    {
    pixels.setPixelColor(i, pixels.Color(0, 0, 255));
    pixels.show(); 
    }
   delay(DELAYVAL);
    for(int i=0; i<NUMPIXELS; i++) 
    {
    pixels.setPixelColor(i, pixels.Color(0, 0, 0));
    pixels.show(); 
    }

}

Don't use a for loop, rather let the loop() function do what it is best at, ie looping

To do this you need to eliminate delay()s from your sketch and use millis() for timing instead

Take a look at Using millis() for timing. A beginners guide, Several things at the same time and the BlinkWithoutDelay example in the IDE