Added effect blur2d
This commit is contained in:
parent
b5c99c320b
commit
fa5f1c8816
16
include/effect_blur2d.h
Normal file
16
include/effect_blur2d.h
Normal file
@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "prototypes.h"
|
||||
#include "functions.h"
|
||||
#include "Effect.h"
|
||||
|
||||
class Blur2DEffect : public Effect {
|
||||
private:
|
||||
Window* window = new Window(0, 0, LED_WIDTH, LED_HEIGHT-6);
|
||||
public:
|
||||
~Blur2DEffect();
|
||||
boolean supports_window = true;
|
||||
boolean can_be_shown_with_clock();
|
||||
void loop();
|
||||
};
|
||||
|
31
src/effect_blur2d.cpp
Normal file
31
src/effect_blur2d.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
#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;
|
||||
}
|
@ -20,6 +20,7 @@
|
||||
#include "effect_dvd.h"
|
||||
#include "effect_analogclock.h"
|
||||
#include "effect_sines.h"
|
||||
#include "effect_blur2d.h"
|
||||
|
||||
Effect* current_effect;
|
||||
|
||||
@ -55,6 +56,7 @@ Effect* select_effect(uint32_t code) {
|
||||
case 24: case 0x8325C1DF /* dvd */ : return new DvdEffect();
|
||||
case 25: case 0x8CA97519 /* analog_clock */ : return new AnalogClockEffect();
|
||||
case 26: case 0xADB18CC5 /* sines */ : return new SinesEffect();
|
||||
case 27: case 0x0407881E /* blur2d */ : return new Blur2DEffect();
|
||||
default : return NULL;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user