     strip.setPixelColor(i, rgb_to_hexcolor(blended_rgb));
     
     config[i].state = config[i].state + config[i].speed;
-    if( config[i].state <= 0 || config[i].state >= 100 ) {
+    if( config[i].speed > 0 )
+      config[i].state = config[i].state + random(0, config[i].randomness);
+    else
+      config[i].state = config[i].state - random(0, config[i].randomness);
+    if( config[i].state <= (100 - config[i].depth) || config[i].state >= 100 ) {
       config[i].speed = -config[i].speed;
     }
-    if( config[i].state <= 0 )
-      config[i].state = 0;
+    if( config[i].state <= (100 - config[i].depth) )
+      config[i].state = (100 - config[i].depth);
     if( config[i].state >= 100 )
       config[i].state = 100;
   }

  int speed;
  uint8_t brightness;
  int state;
};
static pix_config config[pixelCount]; 


// Love to Code

// Rainbow tape "Fade Color" demo in HSV space.

// In this variant, we fade using HSV space, instead of alpha blending
// We also add randomness and depth, so we can use this demo to create
// simple flame effects, as demonstrated on the default pix0 configuration

// select colors codes using the "Rainbow Gadget".
// or use any color from https://github.com/chibitronics/ltc-compiler-layer/blob/master/support/html_colors.h
#include "html_colors.h"
int pix0_colorA = COLOR_ORANGERED;  // can specify color as hex code
int pix0_colorB = COLOR_RED;   // or specify color as html-standard name
int pix0_speed = 3;             // a number 0-100, how fast the transitions happen
int pix0_brightness = 80;       // a number 0-100, how bright the overall effect is
int pix0_randomness = 20;       // a number 0-100, how random the timing is between color transitions
int pix0_depth = 20;            // a number 0-100, how dark to get between transitions

int pix1_colorA = COLOR_GREEN;
int pix1_colorB = COLOR_RED;
int pix1_speed = 5;
int pix1_brightness = 20;
int pix1_randomness = 0;
int pix1_depth = 100;

int pix2_colorA = COLOR_BLUE;
int pix2_colorB = COLOR_HOTPINK;
int pix2_speed = 4;
int pix2_brightness = 100;
int pix2_randomness = 0;
int pix2_depth = 100;

int pix3_colorA = COLOR_TEAL;
int pix3_colorB = COLOR_FUCHSIA;
int pix3_speed = 3;
int pix3_brightness = 80;
int pix3_randomness = 0;
int pix3_depth = 100;

int pix4_colorA = COLOR_RED;
int pix4_colorB = COLOR_BLUE;
int pix4_speed = 2;
int pix4_brightness = 15;
int pix4_randomness = 0;
int pix4_depth = 100;

#include "Adafruit_NeoPixel.h"

