/*
* LED Matrix Animation Code Generated by LED Matrix Animator
*/
#include <FastLED.h>
#define LED_PIN    3   // Pin where the LED matrix is connected
#define NUM_LEDS   256 // Total number of LEDs
#define SPEED      500
#define COLOR_DEPTH 16
CRGB leds[NUM_LEDS];
CRGBPalette16 currentPalette;
// Animation Frames
const uint8_t frames[][128] PROGMEM = { // Adjusted to use half size
  { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 },
  { 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
  { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x02 },
  { 0x20, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
  { 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x02 },
  { 0x20, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00 },
  { 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x02 },
  { 0x20, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00 },
  { 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x02 },
  { 0x20, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00 },
  { 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x02 },
  { 0x20, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00 },
  { 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 },
  { 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00 },
  { 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 },
  { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 }
};
void setup() {
  FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
  currentPalette = CRGBPalette16(CRGB::Black, CRGB::White, CRGB::Red, CRGB::Lime,
    CRGB::Blue, CRGB::Yellow, CRGB::Cyan, CRGB::Magenta,
    CRGB::Silver, CRGB::Gray, CRGB::Maroon, CRGB::Olive,
    CRGB::Green, CRGB::Purple, CRGB::Teal, CRGB::Navy
  );
}
void loop() {
  playAnimation();
}
const int totalFrames = 1;
void playAnimation() {
  for (int f = 0; f < totalFrames; f++) {
    for (int i = 0; i < NUM_LEDS / 2; i++) {
      uint8_t packedByte = pgm_read_byte(&frames[f][i]);
      uint8_t highNibble = (packedByte >> 4) & 0x0F;
      leds[i * 2] = ColorFromPalette(currentPalette, highNibble * (255 / (COLOR_DEPTH - 1)));
      uint8_t lowNibble = packedByte & 0x0F;
      leds[i * 2 + 1] = ColorFromPalette(currentPalette, lowNibble * (255 / (COLOR_DEPTH - 1)));
    }
    FastLED.show();
    delay(SPEED);
  }
}