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

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

References sin32().

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

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