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

◆ ease16InOutCubic()

LIB8STATIC uint16_t ease16InOutCubic ( uint16_t i)

Definition at line 479 of file lib8tion.h.

479 {
480 // This function produces wrong results, use fl::easeInOutCubic16 instead
481 //
482 // 16-bit cubic ease-in / ease-out function
483 // Equivalent to ease8InOutCubic() but for 16-bit values
484 // Formula: 3(x^2) - 2(x^3) applied with proper ease-in-out curve
485
486 // Apply the cubic formula directly, similar to the 8-bit version
487 // scale16(a, b) computes (a * b) / 65536
488 uint32_t ii = scale16(i, i); // i^2 scaled to 16-bit
489 uint32_t iii = scale16(ii, i); // i^3 scaled to 16-bit
490
491 // Apply cubic formula: 3x^2 - 2x^3
492 uint32_t r1 = (3 * ii) - (2 * iii);
493
494 // Clamp result to 16-bit range
495 if (r1 > 65535) {
496 return 65535;
497 }
498 return (uint16_t)r1;
499}
LIB8STATIC uint16_t scale16(uint16_t i, fract16 scale)
Scale a 16-bit unsigned value by an 16-bit value, which is treated as the numerator of a fraction who...
Definition scale8.h:551

References LIB8STATIC, and scale16().

+ Here is the call graph for this function: