Small fixes and tweaks to blur2d, clock and firework.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Fabian Schlenz 2019-09-25 20:05:18 +02:00
parent c1024b3423
commit 075f434997
3 changed files with 24 additions and 24 deletions

View File

@ -5,17 +5,17 @@ boolean Blur2DEffect::can_be_shown_with_clock() {
} }
void Blur2DEffect::loop() { void Blur2DEffect::loop() {
uint8_t blur_amount = dim8_raw(beatsin8(3, 64, 192)); uint8_t blur_amount = dim8_raw(beatsin8(3, 128, 224));
window->blur(blur_amount); window->blur(blur_amount);
uint8_t x1 = beatsin8(5, 0, window->width-1); uint8_t x1 = beatsin8(7, 0, window->width-1);
uint8_t y1 = beatsin8(8, 0, window->height-1); uint8_t y1 = beatsin8(11, 0, window->height-1);
uint8_t x2 = beatsin8(8, 0, window->width-1); uint8_t x2 = beatsin8(13, 0, window->width-1);
uint8_t y2 = beatsin8(3, 0, window->height-1); uint8_t y2 = beatsin8(8, 0, window->height-1);
uint8_t x3 = beatsin8(4, 0, window->width-1); uint8_t x3 = beatsin8(11, 0, window->width-1);
uint8_t y3 = beatsin8(7, 0, window->height-1); uint8_t y3 = beatsin8(13, 0, window->height-1);
uint16_t ms = millis(); uint16_t ms = millis();
CRGB c1 = CHSV(ms / 29, 200, 255); CRGB c1 = CHSV(ms / 29, 200, 255);

View File

@ -13,7 +13,7 @@ void NightClockEffect::loop() {
//uint8_t y = minutes % ((window->height - 5) * 2 - 2); //uint8_t y = minutes % ((window->height - 5) * 2 - 2);
//if (y > window->height - 5) y = 2*window->height - 2*y; //if (y > window->height - 5) y = 2*window->height - 2*y;
uint8_t y = minutes % 10; uint8_t y = minutes % 10;
ClockEffect::loop(false, CRGB(0x880000), CRGB(0x000000), y); ClockEffect::loop(false, CRGB(0x200000), CRGB(0x000000), y);
} }
void ClockEffect::loop() { void ClockEffect::loop() {
@ -34,7 +34,7 @@ void ClockEffect::loop(boolean invert, CRGB fg_color, CRGB bg_color, uint8_t yPo
// Manually clear the needed parts // Manually clear the needed parts
for(int y=0; y<6; y++) { for(int y=0; y<6; y++) {
window->setPixel(3, yPos+y, &bg_color); window->setPixel(3, yPos+y, &bg_color);
if (y!=2 && y!=4) { if (y!=1 && y!=3) {
window->setPixel(7, yPos+y, &bg_color); window->setPixel(7, yPos+y, &bg_color);
} }
window->setPixel(8, yPos+y, &bg_color); window->setPixel(8, yPos+y, &bg_color);

View File

@ -7,7 +7,7 @@ FireworkEffectDot::FireworkEffectDot(Window* w, FireworkEffect* e) {
show = 0; show = 0;
type = FIREWORK_DOT_NONE; type = FIREWORK_DOT_NONE;
_x = 0; _x = 0;
_y = 0; _y = _window->height - 1;
_xv = 0; _xv = 0;
_yv = 0; _yv = 0;
_r = 0; _r = 0;
@ -70,7 +70,7 @@ void FireworkEffectDot::move() {
} }
// Bounce if we hit the ground // Bounce if we hit the ground
if (_xv < 0 && _y < (-_yv)) { if (_xv < 0 && _y - _window->height < (-_yv)) {
if (type == FIREWORK_DOT_SPARK) { if (type == FIREWORK_DOT_SPARK) {
show = 0; show = 0;
} else { } else {
@ -84,7 +84,7 @@ void FireworkEffectDot::move() {
if (_yv < 300) { if (_yv < 300) {
if (type == FIREWORK_DOT_SHELL) { if (type == FIREWORK_DOT_SHELL) {
if (_y > (uint16_t)0x8000) { if (_y < (uint16_t)0x8000) {
// boom // boom
CRGB white(0xFFFFFF); CRGB white(0xFFFFFF);
_window->clear(&white); _window->clear(&white);
@ -103,7 +103,7 @@ void FireworkEffectDot::move() {
} else { } else {
_x += _xv; _x += _xv;
} }
_y += _yv; _y -= _yv;
} }
void FireworkEffectDot::ground_launch() { void FireworkEffectDot::ground_launch() {