FastLED 3.9.15
Loading...
Searching...
No Matches

◆ ease8InOutApprox()

LIB8STATIC fract8 ease8InOutApprox ( fract8 i)

Fast, rough 8-bit ease-in/ease-out function.

Shaped approximately like ease8InOutCubic(), it's never off by more than a couple of percent from the actual cubic S-curve, and it executes more than twice as fast. Use when the cycles are more important than visual smoothness. Asm version takes around 7 cycles on AVR.

Definition at line 603 of file lib8tion.h.

604{
605 if( i < 64) {
606 // start with slope 0.5
607 i /= 2;
608 } else if( i > (255 - 64)) {
609 // end with slope 0.5
610 i = 255 - i;
611 i /= 2;
612 i = 255 - i;
613 } else {
614 // in the middle, use slope 192/128 = 1.5
615 i -= 64;
616 i += (i / 2);
617 i += 32;
618 }
619
620 return i;
621}

References LIB8STATIC.