8-bit quadratic ease-in/ease-out function Takes an input value 0-255 and returns an eased value 0-255 The curve starts slow, accelerates in the middle, then slows down again
Definition at line 55 of file ease.cpp.
55 {
56 constexpr u16
MAX = 0xFF;
57 constexpr u16 HALF = (
MAX + 1) >> 1;
58 constexpr u16 DENOM =
MAX;
59 constexpr u16 ROUND = DENOM >> 1;
60
61 if (i < HALF) {
62
64 u32 num = 2 *
t *
t + ROUND;
65 return u8(num / DENOM);
66 } else {
67
68
70 u32 num = 2 * d * d + ROUND;
71 return u8(
MAX - (num / DENOM));
72 }
73}
References MAX, and t.
Referenced by ease8(), and ease8().