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

◆ noiseCircleDraw()

void fl::PerlinParticlePunch::noiseCircleDraw ( u32 now,
fl::span< CRGB > dst )
private

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

252 {
253 // Apply time-warp to rotation speed — this is the visible acceleration
254 u32 warped_now = u32(float(now) * mTimeMultiplier);
255 s16x16 time_factor = s16x16::from_raw(static_cast<i32>(warped_now * 32u));
256 constexpr s16x16 two_pi(6.2831853f);
257 s16x16 step = two_pi / s16x16(i32(mNumLeds));
258 s16x16 theta = -time_factor;
259 constexpr s16x16 threshold(32.0f);
260 constexpr s16x16 zero(0.0f);
261 constexpr s16x16 max_val(255.0f);
262 for (u16 i = 0; i < mNumLeds; ++i) {
263 s16x16 val = circleNoiseGen(now + 1000, theta);
264 if (val < threshold) {
265 val = zero;
266 } else {
267 val = mapf(val, threshold, max_val, zero, max_val);
268 }
269 u8 val_u8 = u8(val.to_int());
270 // Palette lookup: val_u8 selects color AND brightness
271 dst[i] = ColorFromPalette(mNoisePalette, val_u8, val_u8, LINEARBLEND);
272 theta = theta + step;
273 }
274}
u16 mNumLeds
Definition fx.h:53
static s16x16 mapf(s16x16 x, s16x16 in_min, s16x16 in_max, s16x16 out_min, s16x16 out_max)
s16x16 circleNoiseGen(u32 now, s16x16 theta) const
static constexpr FASTLED_FORCE_INLINE s16x16 from_raw(i32 raw) FL_NOEXCEPT
Definition s16x16.h:54
unsigned char u8
Definition stdint.h:131
CRGB ColorFromPalette(const CRGBPalette16 &pal, fl::u8 index, fl::u8 brightness, TBlendType blendType)
constexpr enable_if< is_fixed_point< T >::value, T >::type step(T edge, T x) FL_NOEXCEPT

References circleNoiseGen(), fl::ColorFromPalette(), fl::s16x16::from_raw(), mapf(), mNoisePalette, fl::Fx::mNumLeds, mTimeMultiplier, fl::step(), and fl::s16x16::to_int().

Referenced by draw().

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