Fast Led-changing colors/lengths every loop

I have eight APA102C LED strips connected series with each strip containing 17 LED’s. I modified the Adafruit “strandtest” example code to create eight heads and tails that run down each LED strip. It looks like an “LED snake” running down each of the eight strips over and over.

I wanted to be able to control the color and the length of the snake so that both the length and color changes every specified number of loops. I attempted to change the colors based on a loop counter, but the colors I put in for various loops all effect one LED on the first snake, and subsequent snakes are all the same color.
For example:

float  x = CRGB::Red ;    

void loop(){
  if (loop1 >= 5)
    {
      x = CRGB::Gold;
     }
}

This statement makes some of the LED’s on the first snake blue, when what I wanted was to set the color of the entire snake to blue once the loop counter is >= 5. The full code is below, the first snake starts out multiple colors (red, gold, white), and turns to blue as it moves down the LED’s. The first snake turns all blue by the time it reaches the last LED and all the rest of the snakes that follow are completely blue.

I also wanted to be able to change the length of the snake based on the number of loops as well. I attempted this by resetting the tail length after a certain number of loops.

 if (loop1 > 3)  //If loop1>3, change the tails to these numbers
{

  tail = 17,
  tail1 = 51,
  tail2 = 85,
  tail3 = 119;  
  tail4 = 118;  
  tail5 = 46;   
  tail6 = 84; 
  tail7 = 16;  
}'

After the first snake goes down one segment of the LED’s never reset so instead of a snake that’s 5 LED’s long, it goes the full length of the LED strip and never runs again because all the LED’s are on.

FULL CODE:

#include <Adafruit_DotStar.h>
#include <FastLED.h>
#include <SPI.h>         // COMMENT OUT THIS LINE FOR GEMMA OR TRINKET

#define NUMPIXELS 136 // Number of LEDs in strip
#define BRIGHTNESS  10

// Here's how to control the LEDs from any two pins:
#define DATAPIN    5
#define CLOCKPIN   6

Adafruit_DotStar strip = Adafruit_DotStar(
                           NUMPIXELS, DATAPIN, CLOCKPIN, DOTSTAR_BGR);

void setup() {
  strip.begin(); // Initialize pins for output
  strip.show();  // Turn all LEDs off ASAP
  LEDS.setBrightness(BRIGHTNESS);
  Serial.begin(9600);
}

int      head  = 16,  tail = 20; // Index of first 'on' and 'off' pixels
int      head1  = 50, tail1 = 55; // Index of first 'on' and 'off' pixels
int      head2  = 84, tail2 = 89; // Index of first 'on' and 'off' pixels
int      head3  = 118, tail3 = 123; // Index of first 'on' and 'off' pixels
int      head4  = 119, tail4 = 114; // Index of first 'on' and 'off' pixels
int      head5  = 51, tail5 = 46; // Index of first 'on' and 'off' pixels
int      head6  = 85, tail6 = 80; // Index of first 'on' and 'off' pixels
int      head7  = 17, tail7 = 12; // Index of first 'on' and 'off' pixels

int loop1 = 0;
float  x = CRGB::Red ;

void loop() {


  uint32_t color = x;//CRGB::Red; ///why can't I set the color here for different loops?

  Serial.print(loop1);

  if (loop1 >= 3)
  {
    x = CRGB::Aqua;
  }

  if (loop1 >= 4)
  {
    x = CRGB::Red;
  }

  if (loop1 >= 5)
  {
    x = CRGB::Gold;
  }
  if (loop1 >= 6)
  {
    x = CRGB::Blue;
  }


  if (loop1 < 2)
  {

    tail = 20,
    tail1 = 55,
    tail2 = 89,
    tail3 = 123;
    tail4 = 114;
    tail5 = 46;
    tail6 = 80;
    tail7 = 12;
  }

  if (loop1 > 3)
  {

    tail = 19,
    tail1 = 54,
    tail2 = 85,
    tail3 = 122;
    tail4 = 117;
    tail5 = 49;
    tail6 = 88;
    tail7 = 19;
  }

  strip.setPixelColor(head, color); // 'On' pixel at head
  strip.setPixelColor(tail, 0);     // 'Off' pixel at tail

  strip.setPixelColor(head1, color); // 'On' pixel at head
  strip.setPixelColor(tail1, 0);     // 'Off' pixel at tail

  strip.setPixelColor(head2, color); // 'On' pixel at head
  strip.setPixelColor(tail2, 0);     // 'Off' pixel at tail

  strip.setPixelColor(head3, color); // 'On' pixel at head
  strip.setPixelColor(tail3, 0);     // 'Off' pixel at tail

  strip.setPixelColor(head4, color); // 'On' pixel at head
  strip.setPixelColor(tail4, 0);     // 'Off' pixel at tail

  strip.setPixelColor(head5, color); // 'On' pixel at head
  strip.setPixelColor(tail5, 0);     // 'Off' pixel at tail

  strip.setPixelColor(head6, color); // 'On' pixel at head
  strip.setPixelColor(tail6, 0);     // 'Off' pixel at tail

  strip.setPixelColor(head7, color); // 'On' pixel at head
  strip.setPixelColor(tail7, 0);     // 'Off' pixel at tail

  strip.show();                     // Refresh strip
  delay(20);                        // Pause 20 milliseconds (~50 FPS)

  //////////////
  if (--head <= 0) {        // Increment head index.  Off end of strip?
    head = 16;                       //  Yes, reset head index to start
  }
  if (--tail <= 0) tail = 16; // Increment, reset tail index

  ////////////////
  if (--head1 <= 34) {        // Increment head index.  Off end of strip?
    head1 = 50;                       //  Yes, reset head index to start
  }
  if (--tail1 <= 34)
    tail1 = 50; // Increment, reset tail index

  /////////////////
  if (--head2 <= 68) {        // Increment head index.  Off end of strip?
    head2 = 84;                       //  Yes, reset head index to start
  }
  if (--tail2 <= 68)
    tail2 = 84; // Increment, reset tail index

  /////////////////
  if (--head3 <= 102) {        // Increment head index.  Off end of strip?
    head3 = 118;                       //  Yes, reset head index to start
  }
  if (--tail3 <= 102)
    tail3 = 118; // Increment, reset tail index

  ///////////////// COUNTING FORWARD HERE
  if (++head4 >= 135) {        // Increment head index.  Off end of strip?
    head4 = 119;                       //  Yes, reset head index to start
  }
  if (++tail4 >= 135)
    tail4 = 119; // Increment, reset tail index

  ///////////////// COUNTING FORWARD HERE
  if (++head5 >= 67) {        // Increment head index.  Off end of strip?
    head5 = 51;                       //  Yes, reset head index to start
  }
  if (++tail5 >= 67)
    tail5 = 51; // Increment, reset tail index

  ///////////////// COUNTING FORWARD HERE
  if (++head6 >= 101) {        // Increment head index.  Off end of strip?
    head6 = 85;                       //  Yes, reset head index to start
  }
  if (++tail6 >= 101)
    tail6 = 85; // Increment, reset tail index

  ///////////////// COUNTING FORWARD HERE
  if (++head7 >= 33) {        // Increment head index.  Off end of strip?
    head7 = 17;                       //  Yes, reset head index to start
  }
  if (++tail7 >= 33)
    tail7 = 17; // Increment, reset tail index

  loop1++;

  FastLED.clear ();

}
}