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

◆ easeOutSine16()

u16 fl::easeOutSine16 ( u16 i)

16-bit sine ease-out function Takes an input value 0-65535 and returns an eased value 0-65535

Definition at line 296 of file ease.cpp.

296 {
297 // ease-out sine: sin(t * π/2)
298 // Handle boundary conditions explicitly
299 if (i == 0)
300 return 0;
301 if (i == 65535)
302 return 65535;
303
304 // For 16-bit: use sin32 for efficiency and accuracy
305 // Map i from [0,65535] to [0,4194304] in sin32 space (zero to quarter wave)
306 // Formula: sin(t * π/2) where t goes from 0 to 1
307 // sin32 quarter cycle is 16777216/4 = 4194304
308 u32 angle = ((fl::u64)i * 4194304ULL) / 65535ULL;
309 i32 sin_result = fl::sin32(angle);
310
311 // Convert sin32 output range [-2147418112, 2147418112] to [0, 65535]
312 // sin32 output is in range -32767*65536 to +32767*65536
313 // For ease-out sine, we only use positive portion [0, 2147418112] -> [0, 65535]
314 return (u16)((fl::u64)sin_result * 65535ULL / 2147418112ULL);
315}
static FASTLED_FORCE_INLINE i32 sin32(u32 angle)
Definition sin32.h:36

References sin32().

Referenced by ease16(), ease16(), and easeOutSine8().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: