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

◆ easeOutCubic8()

u8 fl::easeOutCubic8 ( u8 i)

8-bit cubic ease-out function Takes an input value 0-255 and returns an eased value 0-255 More pronounced deceleration than quadratic

Definition at line 120 of file ease.cpp.

120 {
121 // ease-out cubic: 1 - (1-t)³
122 // For 8-bit: y = MAX - (MAX-i)³ / MAX²
123 constexpr u16 MAX = 0xFF;
124 constexpr u32 DENOM = (u32)MAX * MAX;
125 constexpr u32 ROUND = DENOM >> 1;
126
127 u32 d = MAX - i; // (MAX - i)
128 u32 cube = d * d * d; // (MAX-i)³
129 u32 num = cube + ROUND;
130 return u8(MAX - (num / DENOM));
131}
#define MAX(a, b)
Definition math_macros.h:37
unsigned char u8
Definition int.h:17

References MAX.

Referenced by ease8(), and ease8().

+ Here is the caller graph for this function: