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

◆ getPower()

float fl::Particles1d::Particle::getPower ( u32 now) const
Returns
Power level from 1.0 (birth) to 0.0 (death)

Definition at line 90 of file particles.cpp.hpp.

90 {
91 if (!active || !lifetime) return 0.0f;
92 float power = 1.0f - (float)(now - birthTime) / lifetime;
93 return fl::clamp(power, 0.0f, 1.0f);
94}
constexpr enable_if< is_fixed_point< T >::value, T >::type clamp(T x, T lo, T hi) FL_NOEXCEPT
bool active
Active flag (false = available for reuse)
Definition particles.h:108
u32 lifetime
Lifespan in milliseconds.
Definition particles.h:107
u32 birthTime
Spawn timestamp (ms)
Definition particles.h:106

References active, birthTime, fl::clamp(), and lifetime.

Referenced by draw(), and update().

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