# include <Adafruit_NeoPixel.h>

# define neoPIN   8
# define nPixels  24

Adafruit_NeoPixel theStrip = Adafruit_NeoPixel(nPixels, neoPIN, NEO_GRB + NEO_KHZ800);

void setup() {
  Serial.begin(115200);
  Serial.println("Jello Whirled!\n");

  theStrip.begin();
}

unsigned char traveller;    // index of moving LED
unsigned long lastTime;     // regulate loop to frame rate

# define FRAME  20    // frame time in ms
# define STEP   10    // frames per step
# define FADE   3     // fade amount per frame

unsigned char bigTick;// count STEP to action

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

  if (now - lastTime < FRAME)
    return;

  lastTime = now;

  if (++bigTick >= STEP) {
    traveller++;
    if (traveller >= nPixels) traveller = 0;
  
    theStrip.setPixelColor(traveller, 0x0000ff);
    bigTick = 0;
  }

  theStrip.show();

  ageLEDs();
}

// reduce all RGB of all LEDs just a little bit
void ageLEDs()
{
	unsigned char *blast = theStrip.getPixels();

	for (int ii = 0; ii < (nPixels * 3); ii++, blast++) {
		if (*blast < 3) *blast = 0;
		else *blast -= 3;
	}
}