MCPcopy Create free account
hub / github.com/FastLED/FastLED / noiseCircleDraw

Method noiseCircleDraw

src/fl/fx/1d/perlin_particle_punch.cpp.hpp:252–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

250}
251
252void PerlinParticlePunch::noiseCircleDraw(u32 now, fl::span<CRGB> dst) {
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}
275
276// ---------------------------------------------------------------------------
277// Rendering helpers

Callers

nothing calls this directly

Calls 5

mapfFunction · 0.85
ColorFromPaletteFunction · 0.85
u32Enum · 0.50
s16x16Class · 0.50
to_intMethod · 0.45

Tested by

no test coverage detected