// https://forum.makerforums.info/t/2-dimensional-blur-this-video-shows-the-new-blur2d-capability-newly-available-on-the-fastled/64648
// https://gist.github.com/kriegsman/5adca44e14ad025e6d3b
#include <FastLED.h>
const uint8_t kMatrixWidth = 32;
const uint8_t kMatrixHeight = 32;
const uint8_t kBorderWidth = 2;
#define NUM_LEDS (kMatrixWidth*kMatrixHeight)
CRGB leds[NUM_LEDS];
// Color correction for the SmartMatrix
#define COLOR_CORRECTION CRGB(255,110,178)
void setup()
{
FastLED.addLeds<NEOPIXEL, 3>(leds, NUM_LEDS);
}
void loop()
{
static uint8_t counter = 0 ;
// Apply some blurring to whatever's already on the matrix
// Note that we never actually clear the matrix, we just constantly
// blur it repeatedly. Since the blurring is 'lossy', there's
// an automatic trend toward black -- by design.
if( counter % 3 == 0 ) {
// uint8_t blurAmount = beatsin8(10, 10, 255);
blur2d( leds, kMatrixWidth, kMatrixHeight, 128);
}
counter++;
// Use two out-of-sync sine waves
uint8_t i = beatsin8( 27, kBorderWidth, kMatrixHeight-kBorderWidth);
uint8_t j = beatsin8( 41, kBorderWidth, kMatrixWidth-kBorderWidth);
// Also calculate some reflections
uint8_t ni = (kMatrixWidth-1)-i;
uint8_t nj = (kMatrixWidth-1)-j;
// The color of each point shifts over time, each at a different speed.
uint16_t ms = millis();
leds[XY( i, j)] += CHSV( ms / 11, 255, 255);
leds[XY( j, i)] += CHSV( ms / 13, 255, 255);
leds[XY(ni,nj)] += CHSV( ms / 17, 255, 255);
leds[XY(nj,ni)] += CHSV( ms / 29, 255, 255);
leds[XY( i,nj)] += CHSV( ms / 37, 255, 255);
leds[XY(ni, j)] += CHSV( ms / 41, 255, 255);
FastLED.show();
}
uint16_t XY(uint8_t x, uint8_t y) {
if (x >= kMatrixWidth) return NUM_LEDS;
if (y >= kMatrixHeight) return NUM_LEDS;
return y * kMatrixWidth + x;
}
FPS: 0
Power: 0.00W
Power: 0.00W