Thanks Trace 😊 - I just enjoy helping other, so you're most welcome.
I think I need another coffee though, trying to understand what you're saying (apologies for that).
The 100/10 is maybe not how that works.
A fade has indeed 2 parameters: stepsize and stepdelay. Lets assume these values are 10 for stepsize and 100 for step delay.
So let's assume we have black as our starting color and we want to go to white. This means that we have to go from 0 to 255.
With a steps zie of 10 this takes 25 or 26 steps. Each step will have a delay, so the total time it takes would be:
Number of steps X step delay per step = 25 X 100ms = 2500 ms = 2,5 seconds.
Note: this may not be 100% accurate to say it will be 25 steps, but I think you got the general idea.
Now coming back to the "end" fade out effect with the Flash: you can tweak the code if you'd like to fit your needs.
I just wrote to code to give you a good starting point, since I wasn't 100% sure what effect you'd prefer.
For example:
void warpFlash(CRGB flashColor, bool blackInBetween, int blackDelay, int flashDuration, bool InstantFlash, int fadeStepsize, int fadeDelay)
{
// FLASH
// temporary black if blackInBetween=true
if(blackInBetween) {
fill_solid( leds, NUM_LEDS, CRGB::Black );
FastLED.show();
delay(blackDelay);
}
// Flash color either instant or with fade
if(InstantFlash)
{
fill_solid( leds, NUM_LEDS, flashColor );
FastLED.show();
delay(flashDuration);
}
else
{
CRGB tmpColor = leds[0]; // copy current color
CRGB previousColor = leds[0];
tmpColor = fadeToColor( tmpColor, flashColor, fadeStepsize, fadeDelay); // fade to flash color
tmpColor = fadeToColor( tmpColor, previousColor, fadeStepsize, fadeDelay); // fade back to start color
}
// temporary black if blackInBetween=true
if(blackInBetween) {
fill_solid( leds, NUM_LEDS, CRGB::Black );
FastLED.show();
delay(blackDelay);
}
}
The bold and red line is where the code fades back to "previousColor".
If you wanted to have the fade out to go faster, you could replace it with something like this:
tmpColor = fadeToColor( tmpColor, previousColor, fadeStepsize/2, fadeDelay); // fade back to start color
or
tmpColor = fadeToColor( tmpColor, previousColor, fadeStepsize, fadeDelay/2); // fade back to start color
I'm just dividing stepsize or stepdelay through 2 (arbitrary number) - you can change the number 2 with something more suitable, or even apply it to both parameters.
This would probably a good approach for testing to see what you like best.
Note: If you'd want to make that variable, by passing stepsize and stepdelay for fadeout, then you could do that as well.
void warpFlash(CRGB flashColor, bool blackInBetween, int blackDelay, int flashDuration, bool InstantFlash, int fadeStepsize, int fadeDelay, int fadeOutStepSize, int fadeOutdelay)
{
// FLASH
// temporary black if blackInBetween=true
if(blackInBetween) {
fill_solid( leds, NUM_LEDS, CRGB::Black );
FastLED.show();
delay(blackDelay);
}
// Flash color either instant or with fade
if(InstantFlash)
{
fill_solid( leds, NUM_LEDS, flashColor );
FastLED.show();
delay(flashDuration);
}
else
{
CRGB tmpColor = leds[0]; // copy current color
CRGB previousColor = leds[0];
tmpColor = fadeToColor( tmpColor, flashColor, fadeStepsize, fadeDelay); // fade to flash color
tmpColor = fadeToColor( tmpColor, previousColor, fadeOutStepSize, fadeOutdelay); // fade back to start color
}
// temporary black if blackInBetween=true
if(blackInBetween) {
fill_solid( leds, NUM_LEDS, CRGB::Black );
FastLED.show();
delay(blackDelay);
}
}
Your call to the function would of course change then as well:
// *** Step 3 - flash
warpFlash(flashColor, blackbetweenFlash, prepostFlashDelay, flashDuration, false, 20, 5, 10, 1);
Which then comes with the question if we'd want to do this for the StarTrekWarp function as well.
Now you see how I got to go overboard hahaha.
I hope this answers your question - again, I just got up and am enjoying my first coffee 😁