I am trying to figure out how to use the easing functions:

I am trying to figure out how to use the easing functions:
from the documentation…

ease8InOutCubic(x) == 3(x^i) - 2(x^3)
ease8InOutApprox(x) ==
faster, rougher, approximation of cubic easing

Does anyone have an example of how it is used or a detailed explanation?

Much thanks in advance!

Easing functions in general are pretty well described here: http://easings.net

The particular easing functions in FastLED take an 8-bit value as input and produce an 8-but value as output.

In general, they can be used when you want a nice transition from one value to another that is more natural looking than a straight linear interpolation.

Do you have a specific use in mind yet, or are you just sort of exploring around?

I am trying to move LED pixels around for a sandglass type effect, and I would like to ease the trajectory/path of the pixels. I am still not sure how the easing functions would be used in this case. Suppose I’d like to move a pixel from position 0, to position 50, and have it ease there, which one of the functions would give me the “eased” interpolation?

Those functions expect a “fractional” value that ranges from 0-255 but which represents 0% to 100% (or 0.0 to 1.0). In order to use it, you need to make your pixel motion be able to be scaled by a percentage.

One way to do this is something like the below (let’s say you want to have your pixel move from position 10 and move to position 40):

int led_start = 10;
int led_end   = 40;
int led_range = led_end - led_start;
for( int i=0; i< led_range; i++ ) {  // move thru range
    fract8 f = (256 * i) / led_range;  // convert range to "fract8" percentage
    fract8 eased = ease8InOutCubic( f ) ; // get eased version
    int pos = led_start + (eased * led_range)/256;
    leds[ pos ] = CRGB::Red;
    FastLED.show();
    delay(50);
    leds[ pos ] = CRGB::Black;
}

There’s a more efficient way to approach it, but this is how I think about the functionality.

ahh that makes great sense. Thank you!