Heya all,
I have been banging my head on the wall because of this coding question I have, and I finally decided to ask for some guidance 
So basically, I’m trying to blend 2 palettes. But I would like it to be done after x millis (about 600 ms), so using ‘nblendPaletteTowardPalette’ is not really helpful.
As such, I’m trying to use the wonderful Lib8tion easing functions to do this, but I can’t wrap my head around what’s the best way to handle the conversion from some elapsed millis to a single byte, to feed to ‘ease8InOutCubic’ or some other easing function.
I’ve implemented this type of behavious numerous times, but in a different environment, where I could use floats all I wanted.
But here… I just don’t know how to approach this…
Thanks!
Hi, I’m wondering why the following wouldn’t work, let’s say in loop():
EVERY_N_MILLISECONDS(25) {
uint8_t maxChanges = 24;
nblendPaletteTowardPalette(currentPalette, targetPalette, maxChanges);
}
@Andrew_Tuline
I don’t think so, because, to complete the blend, the number of times nblendPaletteTowardPalette has to be called is not always the same.
If my palettes are blending from red to green, it would take 255 calls to nblendPaletteTowardPalette, which, using your code, would take 6375ms (25 * 255) to complete.
@Joao_Cabral I’m assuming that FastLED knows to take 24 calls to change from one to the other, hence 24*25 = 600 ms.
Essentially, it would (and I quote Mark), “use a BPM beat to control the varying mix of two source palettes together”.
@Andrew_Tuline Looking at the code, your assumption that it will take 24 calls to blend form one to the other is wrong.
A ‘change’ is basically either adding 1 or subtracting 2 from a single channel of the palette, towards the target channel value.