More (unseccessful) experiments with FireworksEffect.
This commit is contained in:
parent
f7275cc086
commit
026ed27d8e
@ -4,8 +4,10 @@
|
||||
#include "config.h"
|
||||
|
||||
void FireworkEffect::loop() {
|
||||
blur(EFFECT_FIREWORK_BLUR);
|
||||
fadeToBlackBy(leds, LED_COUNT, EFFECT_FIREWORK_FADEOUT_SPEED);
|
||||
|
||||
if (random8(EFFECT_FIREWORK_SHOT_CHANCE)==0) {
|
||||
leds[random16(LED_COUNT)] = CHSV(random8(), 255, 255);
|
||||
}
|
||||
blur(EFFECT_FIREWORK_BLUR);
|
||||
}
|
||||
|
@ -70,34 +70,23 @@ void blur(fract8 blur_amount) {
|
||||
|
||||
void blur_row(uint8_t row_index, fract8 blur_amount) {
|
||||
CRGB* row = &leds[row_index * LED_WIDTH];
|
||||
uint8_t keep = 255 - blur_amount;
|
||||
uint8_t seep = 17; // 15 is zu wenig
|
||||
CRGB carryover = CRGB::Black;
|
||||
for (uint8_t x=0; x<LED_WIDTH; x++) {
|
||||
CRGB currentColor = row[x];
|
||||
CRGB part = currentColor;
|
||||
part.nscale8(seep);
|
||||
currentColor.nscale8(keep);
|
||||
currentColor += carryover;
|
||||
if (x>0) row[x-1]+=part;
|
||||
row[x]=currentColor;
|
||||
carryover = part;
|
||||
CRGB seep = row[x].nscale8(blur_amount);
|
||||
row[x] += carryover;
|
||||
if (x>0) row[x-1] += seep;
|
||||
carryover = seep;
|
||||
}
|
||||
}
|
||||
|
||||
void blur_column(uint8_t col_index, fract8 blur_amount) {
|
||||
uint8_t keep = 255 - blur_amount;
|
||||
uint8_t seep = 17;
|
||||
CRGB carryover = CRGB::Black;
|
||||
for (uint8_t y=0; y<LED_HEIGHT; y++) {
|
||||
CRGB currentColor = leds[XYsafe(col_index, y)];
|
||||
CRGB part = currentColor;
|
||||
part.nscale8(seep);
|
||||
currentColor.nscale8(keep);
|
||||
currentColor += carryover;
|
||||
if (y>0) leds[XYsafe(col_index, y-1)]+=part;
|
||||
leds[XYsafe(col_index, y)]=currentColor;
|
||||
carryover = part;
|
||||
uint16_t led_index = XYsafe(col_index, y);
|
||||
CRGB seep = leds[led_index].nscale8(blur_amount);
|
||||
leds[led_index] += carryover;
|
||||
if (y>0) leds[XYsafe(col_index, y-1)] += seep;
|
||||
carryover = seep;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user