Effect tv_static now also uses subpixel rendering.
This commit is contained in:
parent
7b8dabee43
commit
efe9b924ec
@ -81,7 +81,7 @@ struct Settings {
|
|||||||
} snake;
|
} snake;
|
||||||
|
|
||||||
struct /* tv_static */ {
|
struct /* tv_static */ {
|
||||||
uint16_t black_bar_speed = 3500;
|
uint16_t black_bar_speed = 12;
|
||||||
} tv_static;
|
} tv_static;
|
||||||
} effects;
|
} effects;
|
||||||
};
|
};
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
#include "effect_tv_static.h"
|
#include "effect_tv_static.h"
|
||||||
|
|
||||||
void TvStaticEffect::loop(uint16_t ms) {
|
void TvStaticEffect::loop(uint16_t ms) {
|
||||||
uint8_t dark_position = (millis() % settings.effects.tv_static.black_bar_speed) * _window->width / settings.effects.tv_static.black_bar_speed;
|
//uint8_t dark_position = (millis() % settings.effects.tv_static.black_bar_speed) * _window->width / settings.effects.tv_static.black_bar_speed;
|
||||||
|
accum88 dark_position = (beat16(settings.effects.tv_static.black_bar_speed) * _window->width) >> 8;
|
||||||
for (uint8_t y=0; y<_window->height; y++) {
|
for (uint8_t y=0; y<_window->height; y++) {
|
||||||
uint8_t row_dark_position = (dark_position + y/3) % _window->width;
|
accum88 row_dark_position = (dark_position + (y<<8)/3) % (_window->width<<8);
|
||||||
for (uint8_t x=0; x<_window->width; x++) {
|
for (uint8_t x=0; x<_window->width; x++) {
|
||||||
uint8_t brightness = random8();
|
uint8_t brightness = random8();
|
||||||
uint8_t darkening = 0;
|
uint8_t darkening = 0;
|
||||||
uint8_t distance = x - row_dark_position;
|
accum88 distance = (x<<8) - row_dark_position;
|
||||||
if (distance == 0) darkening = random8(192, 255);
|
if (distance < 256) darkening = random8(distance, 255);
|
||||||
else if (distance == 1) darkening = random8(128, 255);
|
else if (distance < (4<<8)) darkening = random8(distance >> 2, 255);
|
||||||
else if (distance == 2) darkening = random8(92, 192);
|
|
||||||
else if (distance == 3) darkening = random8(32, 128);
|
|
||||||
if (darkening > brightness) brightness = 0;
|
if (darkening > brightness) brightness = 0;
|
||||||
else brightness -= darkening;
|
else brightness -= darkening;
|
||||||
CRGB color(brightness, brightness, brightness);
|
CRGB color(brightness, brightness, brightness);
|
||||||
|
Loading…
Reference in New Issue
Block a user