pitrix/src/effect_blur2d.cpp

32 lines
816 B
C++

#include "effect_blur2d.h"
boolean Blur2DEffect::can_be_shown_with_clock() {
return true;
}
void Blur2DEffect::loop(uint16_t ms) {
uint8_t blur_amount = dim8_raw(beatsin8(3, 128, 224));
window->blur(blur_amount);
uint8_t x1 = beatsin8(7, 0, window->width-1);
uint8_t y1 = beatsin8(11, 0, window->height-1);
uint8_t x2 = beatsin8(13, 0, window->width-1);
uint8_t y2 = beatsin8(8, 0, window->height-1);
uint8_t x3 = beatsin8(11, 0, window->width-1);
uint8_t y3 = beatsin8(13, 0, window->height-1);
uint16_t time = millis();
CRGB c1 = CHSV(time / 29, 200, 255);
CRGB c2 = CHSV(time / 41, 200, 255);
CRGB c3 = CHSV(time / 73, 200, 255);
window->addPixelColor(x1, y1, &c1);
window->addPixelColor(x2, y2, &c2);
window->addPixelColor(x3, y3, &c3);
}
Blur2DEffect::~Blur2DEffect() {
delete window;
}