| 303 | } |
| 304 | |
| 305 | u16 easeOutSine16(u16 i) { |
| 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 | } |
| 325 | |
| 326 | u16 easeInOutSine16(u16 i) { |
| 327 | // ease-in-out sine: -(cos(π*t) - 1) / 2 |
no outgoing calls
no test coverage detected