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 129 of file ease.cpp.hpp.

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

References MAX.

Referenced by ease8(), and ease8().

+ Here is the caller graph for this function: