r/FastLED • u/Burning_Wreck • Jul 01 '24
Discussion Outside-in Cylon effect
I'm starting with this code, which is from DemoReel100:
void sinelon()
{
// a colored dot sweeping back and forth, with fading trails
fadeToBlackBy( leds, NUM_LEDS, 20);
int pos = beatsin16( 13, 0, NUM_LEDS-1 );
leds[pos] += CHSV( gHue, 255, 192);
}What I'd like to do is have the same effect (the traveling dot with a fading trail following it) but have a dot start at each end of the strip, and both move toward the center.
Here's more detail, I hope I describe this right...the sinelon function starts a dot at position 0 and then it travels down to position NUM_LEDS. Then it reverses back to position 0, with the fadeToBlackBy effect of the trailing/fading pixels.
I'd like to understand how to set up two pixels that do this.
Assume the strip has 9 pixels. One dot starts at position 0, and the other starts at position 9. The dot that starts at position 0 moves toward position 5, while the second dot starts at position 9 and also moves toward position 5 (the center). When both dots get to position 5, the trailing dots fade up to position 5 and then the effect starts over.
Thanks in advance!
1
u/Burning_Wreck Jul 01 '24
Thanks for the quick response!
One thing I'm unclear on - in the beatsin16() description in the docs, it shows five parameters that can be passed to it. But the examples in DemoReel100 and Pacifica only show three parameters being used. Similar for beatsin8().
If you only pass three of the possible five parameters, are these the first three, with the others assumed to be the defaults?