pitrix/src/effect_blur2d.cpp

32 lines
796 B
C++
Raw Normal View History

2019-09-25 04:26:27 +00:00
#include "effect_blur2d.h"
boolean Blur2DEffect::can_be_shown_with_clock() {
return true;
}
void Blur2DEffect::loop() {
uint8_t blur_amount = dim8_raw(beatsin8(3, 64, 192));
window->blur(blur_amount);
uint8_t x1 = beatsin8(5, 0, window->width-1);
uint8_t y1 = beatsin8(8, 0, window->height-1);
uint8_t x2 = beatsin8(8, 0, window->width-1);
uint8_t y2 = beatsin8(3, 0, window->height-1);
uint8_t x3 = beatsin8(4, 0, window->width-1);
uint8_t y3 = beatsin8(7, 0, window->height-1);
uint16_t ms = millis();
CRGB c1 = CHSV(ms / 29, 200, 255);
CRGB c2 = CHSV(ms / 41, 200, 255);
CRGB c3 = CHSV(ms / 73, 200, 255);
window->addPixelColor(x1, y1, &c1);
window->addPixelColor(x2, y2, &c2);
window->addPixelColor(x3, y3, &c3);
}
Blur2DEffect::~Blur2DEffect() {
delete window;
}