Hi All, Just wondering if there is there an easy way to interpolate between

Hi All, Just wondering if there is there an easy way to interpolate between colours? e.g. if I do led[1].setHue(10), and then led[1].setHue(20), have FastLED calculate and fade it, rather than have it instantly change? This would make some of my animations less flickry. I could code this myself, but just wondering if it is built in anywhere?
cheers!

Well, here is some text from the library:

  • Linear interpolation between two values, with the
    fraction between them expressed as an 8- or 16-bit
    fixed point fraction (fract8 or fract16).
    lerp8by8( fromU8, toU8, fract8 )
    lerp16by8( fromU16, toU16, fract8 )
    lerp15by8( fromS16, toS16, fract8 )
    == from + (( to - from ) * fract8) / 256)
    lerp16by16( fromU16, toU16, fract16 )
    == from + (( to - from ) * fract16) / 65536)
    map8( in, rangeStart, rangeEnd)
    == map( in, 0, 255, rangeStart, rangeEnd);

I haven’t really messed around with this stuff (yet). Just looking first hand at this, you might be able to use the map8() to set the leds to the difference in hue values you want to see.

IIRC there is also a blend() method that takes two CRGB values and a fract8 in the 2.1 branch (use github code search)

I think the question (correct me if I’m wrong) is asking about animation-over-time. (Yes?)

At this point, the library has mostly static tools; dynamic tools that take a time factor into account (eg, fade from that to this over the next 1500ms) are something we’re considering for the future but there’s no direct toolset provided yet for that.

Some month ago @Mark_Kriegsman posted something about interpolation between two colors in different color spaces. There in the comments i posted the routine I was using for smooth RGB fades between frames. It made all my old shitty code look like eye candy… :wink:
Here the link: https://plus.google.com/112916219338292742137/posts/62NKjuM6oMm