#include <FastLED.h>

#define NUM_LEDS 48
CRGB leds[NUM_LEDS];

void setup() {
  FastLED.addLeds<NEOPIXEL, PB1>(leds, NUM_LEDS);
}

CRGB pattern[] = {
 CRGB(255, 255, 255), CRGB(255, 255, 255),
 CRGB(255, 0, 0), CRGB(255, 0, 0),
 CRGB(0, 255, 0), CRGB(0, 255, 0),
 CRGB(0, 0, 255), CRGB(0, 0, 255),
};
size_t pattern_sz = sizeof(pattern) / sizeof(*pattern);

void loop() {
  // a 8.8 fixed point position (so 256 = 1.0, 512 = 2.0, 65535 = 255.996)
  static uint16_t basepos = 0;
  // a copy of basepos to be modified over the length of the strip
  uint16_t ledpos = basepos;
  for (uint8_t ledno = 0; ledno < NUM_LEDS; ledno++) {
    // find the integer and fractional parts for this LED 
    uint8_t intpos = ledpos >> 8;
    uint8_t fracpos = ledpos & 0xff;
    // select the two colours to be blended for this LED
    CRGB colA = pattern[intpos % pattern_sz];
    CRGB colB = pattern[(intpos + 1) % pattern_sz];
    // fade colA towards colB by the fractional position
    leds[ledno] = blend(colA, colB, fracpos);
    // move along the source pattern by some fraction of a pixel
    ledpos += 128;
  }
  FastLED.show();
  delay(10);
  // move the base position by some fractional amount
  basepos += beatsin8(5, 1, 128);
}
ATTINY8520PU