MCPcopy Create free account
hub / github.com/FastLED/FastLED / time_alpha8

Function time_alpha8

src/fl/math/time_alpha.cpp.hpp:9–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7namespace fl {
8
9u8 time_alpha8(u32 now, u32 start, u32 end) FL_NOEXCEPT {
10 if (now < start) {
11 return 0;
12 }
13 if (now > end) {
14 return 255;
15 }
16 u32 elapsed = now - start;
17 u32 total = end - start;
18 u32 out = (elapsed * 255) / total;
19 if (out > 255) {
20 out = 255;
21 }
22 return static_cast<u8>(out);
23}
24
25u16 time_alpha16(u32 now, u32 start, u32 end) FL_NOEXCEPT {
26 if (now < start) {

Callers 2

update8Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected