What is the best way to morph a pixel from one color to another?
I’d like to create a routine that can take a parameter of the number of steps to get from one CRGB value to another.
Is there anything in the library that can do this?
What is the best way to morph a pixel from one color to another?
I’d like to create a routine that can take a parameter of the number of steps to get from one CRGB value to another.
Is there anything in the library that can do this?
There’s a wide variety of blending functions defined in here - http://fastled.io/docs/3.1/colorutils_8h_source.html
This looks like this may do it but I wish there was a little more detailed info on usage:
CRGB blend ( const CRGB & p1,
const CRGB & p2,
fract8 amountOfP2
)
what is amountOfP2? On what scale is that measured?
CRGB* blend ( const CRGB * src1,
const CRGB * src2,
CRGB * dest,
uint16_t count,
fract8 amountOfsrc2
)
there’s not much documentation on the usage and parameters. What is count here?
For things like scaling and brightness and blending FastLED uses values from 0-255 as a percentage (why 0-255? Because it lets us keep the math fast).
So the parameter amountOfP2 is the “amount of p2” that you want in the final blended color - for example a value of 128 would give you a color that is 50% p1 and 50% p2. While a value of 64 would give you a color that is 75% p1 and 25% p2.
The second version is for when you want to blend two arrays of CRGB objects together - and “count” is passing in how many CRGB objects are in each array.
(The 0-255 scaling thing is documented in a number of places for the library and is a common enough thing that it isn’t added specifically to everywhere that it is used).
thanks for the clarification Daniel! Helpful as always