#include <FastLED.h>
#define LED_PIN 12
#define WIDTH 12
#define HEIGHT 12
#define NUM_LEDS 144
CRGB leds[NUM_LEDS];
// The 32bit version of our coordinates
static uint16_t x;
static uint16_t y;
static uint16_t z;
uint16_t speed = 20;
// uint16_t scale = 1; // mostly just solid colors
// uint16_t scale = 4011; // very zoomed out and shimmery
uint16_t scale = 2026; // very zoomed out and shimmery
// uint16_t scale = 311;
// This is the array that we keep our computed noise values in
uint16_t noise[WIDTH][HEIGHT];
void fillnoise8() {
for (int i = 0; i < WIDTH; i++) {
int i_offset = scale * i;
for (int j = 0; j < HEIGHT; j++) {
int j_offset = scale * j;
noise[i][j] = inoise8(x + i_offset, y + j_offset, z);
}
}
z += speed;
}
void setup() {
FastLED.addLeds<WS2812, LED_PIN>(leds, NUM_LEDS);
// Initialize our coordinates to some random values
x = random16();
y = random16();
z = random16();
}
void loop() {
static uint8_t ihue=0;
fillnoise8();
for (int i = 0; i < WIDTH; i++) {
for (int j = 0; j < HEIGHT; j++) {
// leds[i + (j * HEIGHT)] = CHSV(ihue + (noise[j][i]>>2),255,255);
leds[i + (j * HEIGHT)] = CHSV(noise[j][i],255,255);
// leds[i + (j * HEIGHT)] = CHSV(ihue + i + (j*HEIGHT), 255, ihue % 255);
}
}
FastLED.show();
// ihue++;
delay(50);
}