FastLED 3.10.8
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 130 of file ease.cpp.hpp.

130 {
131 // ease-out cubic: 1 - (1-t)³
132 // For 8-bit: y = MAX - (MAX-i)³ / MAX²
133 constexpr u16 MAX = 0xFF;
134 constexpr u32 DENOM = (u32)MAX * MAX;
135 constexpr u32 ROUND = DENOM >> 1;
136
137 u32 d = MAX - i; // (MAX - i)
138 u32 cube = d * d * d; // (MAX-i)³
139 u32 num = cube + ROUND;
140 return u8(MAX - (num / DENOM));
141}
unsigned char u8
Definition stdint.h:131

References FL_NO_EXCEPT.

Referenced by ease8(), and ease8().

+ Here is the caller graph for this function: