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

◆ update()

uint8_t fl::TimeRamp::update ( uint32_t now)
overridevirtual

Compute current 0–255 output based on how much time has elapsed since trigger().

Implements fl::TimeAlpha.

Definition at line 83 of file time_alpha.cpp.

83 {
84 if (!isActive(now)) {
85 return 0;
86 }
87 // uint32_t elapsed = now - mStart;
88 uint8_t out = 0;
89 if (now < mFinishedRisingTime) {
91 } else if (now < mFinishedPlateauTime) {
92 // plateau
93 out = 255;
94 } else if (now < mFinishedFallingTime) {
95 // ramp down
96 uint8_t alpha =
98 out = 255 - alpha;
99 } else {
100 // finished
101 out = 0;
102 }
103
104 mLastValue = out;
105 return out;
106}
uint8_t mLastValue
Definition time_alpha.h:72
bool isActive(uint32_t now) const override
uint32_t mFinishedFallingTime
Definition time_alpha.h:69
uint32_t mFinishedPlateauTime
Definition time_alpha.h:68
uint32_t mStart
Definition time_alpha.h:71
uint32_t mFinishedRisingTime
Definition time_alpha.h:67
uint8_t time_alpha8(uint32_t now, uint32_t start, uint32_t end)
Definition time_alpha.cpp:8

References isActive(), mFinishedFallingTime, mFinishedPlateauTime, mFinishedRisingTime, mLastValue, mStart, and fl::time_alpha8().

Referenced by applyFancyEffect().

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