Hi all, I'm trying to transition colors at a consistent rate,

Hi all,
I’m trying to transition colors at a consistent rate, similar to how fadeToBlackBy seems to drop to zero in roughly the same number of steps, regardless of the starting color.

The problem that I’m having is that depending on the starting/ending color … sometimes the transition seems to happen more quickly (visually). Imagine the Cylon example, with the fading tail behind the moving pixel … regardless of the moving pixel’s color, I think the tail length is consistent and adjustable based on the fade rate.

Now imagine that the color of all leds on a strip are preset to green, and the moving led is red … the tail length is nice and long, If, however you reverse the two, and make the background red, the tail length is reduced to about a 1/4 of its length because of how quickly the red over takes the green.

I’ve tried this several ways, but maybe I’m missing an obvious approach here (I have yet to master my searching of the fastled reference)

Here is the striped down function I’m currently trying to use for reference …

void test(){
CRGB ledfield = CRGB::Green;
CRGB ledsweep = CRGB::Red;
for ( int b = 0; b < NUM_LEDS; b++ ){
leds[b] = blend( leds[b], ledfield, 20 );
}
leds[beatsin16( 7, 0, NUM_LEDS-1 )] = ledsweep;
}

Since this is running on neighboring strips using different colors, I’d like to get the tails to be consistent for the visual of it. If this is completely the wrong approach here, I’d love to learn the correct one. :slight_smile:

Thanks again

Try adding this inside your for loop, after the leds[b] = blend… line.

EVERY_N_MILLISECONDS(100) {
Serial.print(leds[15].getLuma());
Serial.print(" ");
Serial.println(leds[b].getLuma());
}

Have a look at the output with red as the bg, and then with green as the bg color.
Maybe you can find a good way to scale the blend amount based on the luma value.

Thank Marc … I hadn’t seen getLuma() … I’ll tinker with that for a bit.

Let us all know if that works for you.