41 for (u16 i = 0; i <
size; ++i) {
46 for (u16 i = 0; i <
size; ++i) {
54 if (
width <= 0.0f || amplitude == 0.0f ||
mSize == 0) {
57 const float halfWidth =
width * 0.5f;
60 static_cast<int>(
fl::ceilf(center + halfWidth)));
61 for (
int i = iStart; i <= iEnd; ++i) {
62 float t = (
static_cast<float>(i) - (center - halfWidth)) /
width;
70 float u = (
t - 0.5f) / 0.2f;
81 for (u16 i = 0; i <
mSize; ++i) {
91 for (u16 i = 0; i <
mSize; ++i) {
175 count = (w * h + 3) & ~3;
314 return t *
t *
t * (
t * (
t * 6.0f - 15.0f) + 10.0f);
317 return a +
t * (b - a);
329 static float clampf(
float v,
float lo,
float hi)
FL_NO_EXCEPT;
337 void drawDot(
float cx,
float cy,
float diam,
339 void drawAALine(
float x0,
float y0,
float x1,
float y1,
378 static i32 clamp_q16(i32 v, i32 lo, i32 hi)
FL_NO_EXCEPT;
uint8_t noise[NUM_LAYERS][WIDTH][HEIGHT]
fl::UIButton noisePunch("NoisePunch")
fl::UISlider colorShift("Color Shift", 0.04f, 0.0f, 0.5f, 0.01f)
Alignment macros and utilities for FastLED.
void setDotCount(int count) FL_NO_EXCEPT
NoiseBias2D & noiseBias() FL_NO_EXCEPT
void setPersistence(float halfLife) FL_NO_EXCEPT
void setFlowAmplitudeY(float amp) FL_NO_EXCEPT
virtual void drawImpl(DrawContext context, u32 dt_ms, u32 t_ms) FL_NO_EXCEPT=0
Subclasses implement rendering given the time delta and total time.
void setColorShift(float speed) FL_NO_EXCEPT
FlowField(const XYMap &xyMap, const Params ¶ms=Params()) FL_NO_EXCEPT
void setShowFlowVectors(bool show) FL_NO_EXCEPT
void setNoiseFrequencyY(float freq) FL_NO_EXCEPT
void draw(DrawContext context) FL_NO_EXCEPT override
Handles timing, then delegates to drawImpl().
void noisePunchY(float center, float width, float amplitude=1.0f, BumpShape shape=BumpShape::HalfSine) FL_NO_EXCEPT
Trigger a noise punch on the Y axis (rows).
void setSpeed(float speed) FL_NO_EXCEPT
Set time speed/scale (1.0 = normal, 0.5 = half speed, etc.)
void setNoiseFrequency(float freq) FL_NO_EXCEPT
const Params & getParams() const FL_NO_EXCEPT
void setEmitterMode(int mode) FL_NO_EXCEPT
void setReverseXProfile(bool rev) FL_NO_EXCEPT
void noisePunchX(float center, float width, float amplitude=1.0f, BumpShape shape=BumpShape::HalfSine) FL_NO_EXCEPT
Trigger a noise punch on the X axis (columns).
Params & getParams() FL_NO_EXCEPT
float speed() const FL_NO_EXCEPT
void setFlowAmplitudeX(float amp) FL_NO_EXCEPT
void setFlowSpeedX(float speed) FL_NO_EXCEPT
const NoiseBias2D & noiseBias() const FL_NO_EXCEPT
~FlowField() FL_NO_EXCEPT override=default
void setNoiseFrequencyX(float freq) FL_NO_EXCEPT
void setEndpointSpeed(float speed) FL_NO_EXCEPT
void setFlowSpeedY(float speed) FL_NO_EXCEPT
void setFlowShift(float shift) FL_NO_EXCEPT
FlowFieldFP(const XYMap &xyMap, const Params ¶ms=Params()) FL_NO_EXCEPT
int idx(int y, int x) const FL_NO_EXCEPT
fl::string fxName() const FL_NO_EXCEPT override
friend struct FlowFieldFPProfiler
Pure fixed-point (s16x16) flow field implementation for maximum speed.
static float lerp(float a, float b, float t) FL_NO_EXCEPT
void init(u32 seed) FL_NO_EXCEPT
static float fade(float t) FL_NO_EXCEPT
fl::string fxName() const FL_NO_EXCEPT override
fl::vector< float > mYProf
Per-row values; drives horizontal shift.
fl::vector< float > mXProf
Per-column values; drives vertical shift.
FlowFieldFloat(const XYMap &xyMap, const Params ¶ms=Params()) FL_NO_EXCEPT
int idx(int y, int x) const FL_NO_EXCEPT
Float-precision flow field implementation.
Abstract base class for 2D flow field effects.
u16 xyMap(u16 x, u16 y) const FL_NO_EXCEPT
u16 getWidth() const FL_NO_EXCEPT
Fx2d(const XYMap &xyMap) FL_NO_EXCEPT
void update(float dtSeconds) FL_NO_EXCEPT
Advance all filters by dt seconds.
void trigger(float center, float width, float amplitude, BumpShape shape=BumpShape::HalfSine) FL_NO_EXCEPT
Inject a shaped bump. Multiple triggers per frame accumulate additively.
float get(u16 i) const FL_NO_EXCEPT
u16 size() const FL_NO_EXCEPT
fl::vector< float > mPending
fl::vector< AttackDecayFilter< float > > mFilters
void reset() FL_NO_EXCEPT
NoiseBias1D(u16 size, float attackTau, float decayTau) FL_NO_EXCEPT
Per-position attack/decay bias for one axis.
void triggerY(float center, float width, float amplitude, BumpShape shape=BumpShape::HalfSine) FL_NO_EXCEPT
float getX(u16 x) const FL_NO_EXCEPT
void triggerX(float center, float width, float amplitude, BumpShape shape=BumpShape::HalfSine) FL_NO_EXCEPT
const NoiseBias1D & x() const FL_NO_EXCEPT
NoiseBias2D(u16 width, u16 height, float attackTau, float decayTau) FL_NO_EXCEPT
void reset() FL_NO_EXCEPT
u16 height() const FL_NO_EXCEPT
u16 width() const FL_NO_EXCEPT
float get(u16 x, u16 y) const FL_NO_EXCEPT
const NoiseBias1D & y() const FL_NO_EXCEPT
NoiseBias1D & y() FL_NO_EXCEPT
NoiseBias1D & x() FL_NO_EXCEPT
float getY(u16 y) const FL_NO_EXCEPT
void update(float dtSeconds) FL_NO_EXCEPT
Two-axis attack/decay bias for 2D effects (per-column X + per-row Y).
constexpr common_type_t< T, U > max(T a, U b) FL_NO_EXCEPT
u8 u8 fract8 blur_amount FL_NO_EXCEPT
FL_DISABLE_WARNING_PUSH U constexpr common_type_t< T, U > min(T a, U b) FL_NO_EXCEPT
float sinf(float value) FL_NO_EXCEPT
constexpr enable_if< is_fixed_point< T >::value, T >::type clamp(T x, T lo, T hi) FL_NO_EXCEPT
BumpShape
Shape function for NoiseBias triggers.
@ HalfSine
sin(pi * t), smooth bell, zero at edges
@ Gaussian
exp(-0.5 * ((t-0.5)/sigma)^2), tighter peak
float floorf(float value) FL_NO_EXCEPT
float ceilf(float value) FL_NO_EXCEPT
float expf(float value) FL_NO_EXCEPT
Base definition for an LED controller.
float flow_amp_y
Flow amplitude Y.
float flow_amp_x
Flow amplitude X.
float flow_speed_y
Noise scroll speed Y.
float color_shift
Color shift speed.
bool show_flow_vectors
Draw flow profiles as overlay.
bool reverse_x_profile
Reverse X profile (matches Python)
float endpoint_speed
Lissajous endpoint speed.
int emitter_mode
0=Lissajous, 1=Dots, 2=Both
float flow_shift
Pixel shift amount.
float flow_speed_x
Noise scroll speed X.
float persistence
Trail half-life in seconds.
float noise_freq_y
Noise frequency Y.
float noise_freq_x
Noise frequency X.
int dot_count
Number of orbital dots.
Configuration parameters for FlowField.
#define FASTLED_SHARED_PTR(type)
static fl::i32 grad(fl::u8 hash, fl::i32 x) FL_NO_EXCEPT
Representation of an 8-bit RGB pixel (Red, Green, Blue)
FlowFieldFPState() FL_NO_EXCEPT
fl::vector< fl::i32 > y_prof
fl::vector< fl::i32 > x_prof
void init(int w, int h) FL_NO_EXCEPT
bool fade_lut_initialized
SoA (Structure-of-Arrays) state for FlowFieldFP.