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

◆ spawnAmbient()

void fl::PerlinParticlePunch::spawnAmbient ( float intensity = 0.5f)

Spawn an ambient particle at a random position.

Parameters
intensity0.0-1.0, controls brightness and trail length.

Definition at line 150 of file perlin_particle_punch.cpp.hpp.

150 {
152 if (!p)
153 return;
154 p->alive = true;
155 p->position = 0.0f; // All particles punch out from position 0 (ground)
156 float jitter = float(random8(80, 120)) / 100.0f;
157 p->velocity = (0.5f + intensity * 1.5f) * mSpeed * jitter;
158 p->brightness = 128.0f + intensity * 127.0f;
159 p->paletteIndex = random8();
160 p->headWidth = 3 + random8(3); // 3, 4, or 5
161}
LIB8STATIC fl::u8 random8() FL_NOEXCEPT
Generate an 8-bit random number.
Definition random8.h:53

References fl::PerlinParticlePunch::AmbientParticle::alive, fl::PerlinParticlePunch::AmbientParticle::brightness, fl::PerlinParticlePunch::AmbientParticle::headWidth, mSpeed, fl::PerlinParticlePunch::AmbientParticle::paletteIndex, fl::PerlinParticlePunch::AmbientParticle::position, random8(), tryAllocateAmbient(), and fl::PerlinParticlePunch::AmbientParticle::velocity.

Referenced by ~PerlinParticlePunch().

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