FastLED 3.10.6
Loading...
Searching...
No Matches

◆ applyAttackDecay()

float applyAttackDecay ( float value,
float target,
float attackSeconds,
float decaySeconds,
float deltaSeconds )
Examples
hydropack.ino.

Definition at line 194 of file hydropack.ino.

195 {
196 const float seconds = target > value ? attackSeconds : decaySeconds;
197 if (seconds <= 0.0f) {
198 return target;
199 }
200 const float amount = fl::clamp(deltaSeconds / seconds, 0.0f, 1.0f);
201 return value + (target - value) * amount;
202}
duration< fl::i64 > seconds
Seconds - duration with period of 1 second.
Definition chrono.h:109
constexpr enable_if< is_fixed_point< T >::value, T >::type clamp(T x, T lo, T hi) FL_NO_EXCEPT

References fl::clamp().

Referenced by advanceDoubleEnvelope().

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