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

◆ time_alpha16()

uint16_t fl::time_alpha16 ( uint32_t now,
uint32_t start,
uint32_t end )

Definition at line 24 of file time_alpha.cpp.

24 {
25 if (now < start) {
26 return 0;
27 }
28 if (now > end) {
29 return 65535;
30 }
31 uint32_t elapsed = now - start;
32 uint32_t total = end - start;
33 uint32_t out = (elapsed * 65535) / total;
34 if (out > 65535) {
35 out = 65535;
36 }
37 return static_cast<uint16_t>(out);
38}