These are chat archives for Makuna/NeoPixelBus

30th
Nov 2016
Michael Miller
@Makuna
Nov 30 2016 01:15
When an animation stops; the animation callback is called with a progress value of 1.0; after that; the only way a color of a pixel changes is if another color operation is run on that pixel (someone calls SetPixelColor).
Michael Miller
@Makuna
Nov 30 2016 01:20
consider NeoPixelFunFadeInOut and what calling the function void FadeInFadeOutRinseRepeat(float luminance) does.
If effectState is 1; then it will setup an animation to fade to black and the toggle the effectState from 1 to 0.
If effectState is 0; then it will setup an animation to fade to random color and then toggle the effectState from 0 to 1.
Also consider what the loop of this sample does. I usually don't recommend this model of doing it but its a sample showing one way to do it.
It will check if any animations are actively running, if there are, it will update them and show the results.
If there are no animations running (it finished the last fade) then it will call the above mentioned method to setup and start the next animation (fade to black or fade to color based on the effectState.

if you change the loop to the recommended like...

void loop()
{
        // the normal loop just needs these two to run the active animations
        animations.UpdateAnimations();
        strip.Show();
}

and then at the end of setup after the setting the random seed; just call above mentioned method like...

effectState = 0; // force to setup animation for fade to color
FadeInFadeOutRinseRepeat(0.2f);

and it will do as you want.

Michael Miller
@Makuna
Nov 30 2016 01:27
Of course you can move the call to from the end of Setup to any where you want to trigger the fade to a color and it will work.
Michael Miller
@Makuna
Nov 30 2016 01:37
For NeoPixelFunLoop; it has one animation that purely tracks the time to start a "new" pixel to bloom at the front and setup an animation to fade it. this line in the sample sets the color it fades to; black. If you wanted to randomly leave "turds" then you could add a random if statement that change use a random color instead of black.
NeoPixelFunLoop demonstrates dynamically creating animations (for each new front pixel) that has a specific animation for that pixel.
jakeloggins
@jakeloggins
Nov 30 2016 16:12
Thanks for the help. I had an issue with another part of my code that was constantly overriding the animation. Now everything makes sense. My mistake, sorry.