| 250 | } |
| 251 | |
| 252 | void 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 |
nothing calls this directly
no test coverage detected