Code here: http://pastebin.com/hjtHPvAY
In the pastebin link, the code that's producing the fade in the video is excised, but it was "fadeToBlackBy( leds, NUM_LEDS, 128);" right after FastLED.show(); delay(75);
What I'm trying to get is a fading tail of 2 rows after the main row.
Several things confuse me.
First, I thought fadeToBlackBy( leds, NUM_LEDS, 128) subtracted 128 from 256 (assuming a starting brightness of 256) and then on the next pass, it subtracted 128 from 128. and then at 0 it just stayed black. But now I see that it is actually is a percentage. So in the case of 128, each call of fadeToBlack reduces the brightness by 50 percent. But if that's the case, it is like Zeno's runner paradox. It'll keep getting closer to 0 but never actually getting there:
256 x .5 = 128
128 x .5 = 64
64 x .5 = 32
2 x .5 = 1
1 x .5 = .5
5. x .5 = .25
.25 x .5 = .125
.125 x .5 = .0625
And so on. Yes, in terms of getting the LED to effectively look black, it will get there, but with many more passes than a simple subtraction.
So that's the first thing I don't completely understand. (And I've read through everything I could find on FadeToBlackBy here and elsewhere.)
Ok, so I know that by calling fadeToBlackBy( leds, NUM_LEDS, 128); within a loop that iterates LED by LED (or in my case by a range of LEDs), I am placing a command that calls ALL the LEDs within a loop that is speaking to a range at a time. And that's not good.
So instead, I might want to use the expression like this: leds[i].fadeToBlackBy(128);
But the problem I now face is how to get it to refer to the previous iteration of "i." I could do, for example, i-1, (or in my case, in a command that somehow merges fill_gradient with fadeToBlackBy, i+31 (because I'm going backwards and each band of lights is 31 long)), but that would mess up when it gets to the end.
Any way I try it, I end up either leaving the trail on at a set level (for example, 50 percent less bright than the lead band), or getting a trail that spans all 7 trailing rows that never totally fades out.
So, to make a long story short, I'm stumped. Any ideas?
Also, thank you for this wonderful community!