FastLED 3.10.8
Loading...
Searching...
No Matches

◆ ease16InOutCubic()

LIB8STATIC fl::u16 ease16InOutCubic ( fl::u16 i)

Definition at line 550 of file lib8tion.h.

550 {
551 // This function produces wrong results, use fl::easeInOutCubic16 instead
552 //
553 // 16-bit cubic ease-in / ease-out function
554 // Equivalent to ease8InOutCubic() but for 16-bit values
555 // Formula: 3(x^2) - 2(x^3) applied with proper ease-in-out curve
556
557 // Apply the cubic formula directly, similar to the 8-bit version
558 // scale16(a, b) computes (a * b) / 65536
559 fl::u32 ii = scale16(i, i); // i^2 scaled to 16-bit
560 fl::u32 iii = scale16(ii, i); // i^3 scaled to 16-bit
561
562 // Apply cubic formula: 3x^2 - 2x^3
563 fl::u32 r1 = (3 * ii) - (2 * iii);
564
565 // Clamp result to 16-bit range
566 if (r1 > 65535) {
567 return 65535;
568 }
569 return (fl::u16)r1;
570}

References FL_NO_EXCEPT, and LIB8STATIC.