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

306 {
307 // ease-out sine: sin(t * π/2)
308 // Handle boundary conditions explicitly
309 if (i == 0)
310 return 0;
311 if (i == 65535)
312 return 65535;
313
314 // For 16-bit: use sin32 for efficiency and accuracy
315 // Map i from [0,65535] to [0,4194304] in sin32 space (zero to quarter wave)
316 // Formula: sin(t * π/2) where t goes from 0 to 1
317 // sin32 quarter cycle is 16777216/4 = 4194304
318 u32 angle = ((fl::u64)i * 4194304ULL) / 65535ULL;
319 i32 sin_result = fl::sin32(angle);
320
321 // Convert sin32 output range [-2147418112, 2147418112] to [0, 65535]
322 // sin32 output is in range -32767*65536 to +32767*65536
323 // For ease-out sine, we only use positive portion [0, 2147418112] -> [0, 65535]
324 return (u16)((fl::u64)sin_result * 65535ULL / 2147418112ULL);
325}
FASTLED_FORCE_INLINE i32 sin32(u32 angle) FL_NO_EXCEPT
Definition sin32.h:57
fl::u64 u64
Definition s16x16x4.h:221

References FL_NO_EXCEPT, and sin32().

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

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