30#define NUM_LEDS (WIDTH * HEIGHT)
33#define SERPENTINE true
41 "Flow field visualization with noise-driven advection, creating fluid-like patterns from color emitters. "
42 "Concept by Stefan Petrick, Initial C++ implementation by 4wheeljive. FastLED port adaptation + fixed point "
43 "optmization by Zach Vorhies."
105 float sign = (
random8() < 128) ? 1.0f : -1.0f;
fl::UIDescription description("Demo of the Animatrix effects. @author of fx is StefanPetrick")
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
fl::UISlider flowSpeedY("Y Speed", 0.10f, -2.0f, 2.0f, 0.01f)
fl::UIGroup appearanceGroup("Appearance", endpointSpeed, colorShift, persistence, flowShift, numDots, emitterMode)
fl::UIGroup flowXGroup("Flow X", flowSpeedX, flowAmpX, flowFreqX)
fl::UICheckbox showFlowVectors("Show Flow Vectors", false)
fl::UISlider flowAmpY("Y Amplitude", 1.0f, 0.0f, 2.0f, 0.01f)
fl::XYMap xyMap(WIDTH, HEIGHT, SERPENTINE)
fl::UIGroup debugGroup("Debug", computeMode, showFlowVectors)
fl::UISlider flowFreqX("X Frequency", 0.33f, 0.05f, 4.0f, 0.01f)
fl::UISlider flowAmpX("X Amplitude", 1.0f, 0.0f, 2.0f, 0.01f)
fl::UIButton noisePunch("NoisePunch")
fl::UIDropdown emitterMode("Emitter Mode", {"Lissajous", "Dots", "Both"})
fl::FlowFieldFloat flowFieldFloat(xyMap)
fl::UISlider numDots("Dots", 3, 1, 5, 1)
fl::UISlider flowFreqY("Y Frequency", 0.32f, 0.05f, 4.0f, 0.01f)
fl::UISlider endpointSpeed("Endpoint Speed", 0.80f, 0.05f, 2.0f, 0.01f)
fl::UISlider colorShift("Color Shift", 0.04f, 0.0f, 0.5f, 0.01f)
fl::UITitle title("FlowFields")
fl::UISlider flowShift("Pixel Shift", 1.8f, 0.5f, 4.0f, 0.1f)
fl::UIGroup flowYGroup("Flow Y", flowSpeedY, flowAmpY, flowFreqY)
fl::UISlider persistence("Trail Half-Life (s)", 0.86f, 0.05f, 5.0f, 0.01f)
fl::UIDropdown computeMode("Compute Mode", {"Float", "Fixed-Point (Fast)"})
fl::UISlider flowSpeedX("X Speed", 0.10f, -2.0f, 2.0f, 0.01f)
fl::FlowFieldFP flowFieldFP(xyMap)
void setDotCount(int count) FL_NO_EXCEPT
void setPersistence(float halfLife) FL_NO_EXCEPT
void setFlowAmplitudeY(float amp) FL_NO_EXCEPT
void setColorShift(float speed) 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 setEmitterMode(int mode) 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).
void setFlowAmplitudeX(float amp) FL_NO_EXCEPT
void setFlowSpeedX(float speed) FL_NO_EXCEPT
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
Pure fixed-point (s16x16) flow field implementation for maximum speed.
Float-precision flow field implementation.
Abstract base class for 2D flow field effects.
u16 getWidth() const FL_NO_EXCEPT
u16 getHeight() const FL_NO_EXCEPT
::fl::DrawContext DrawContext
2D flow field visualization: emitters paint color, noise advects it
LIB8STATIC fl::u8 random8() FL_NO_EXCEPT
Generate an 8-bit random number.
Aggregator header for the fl/ui/ family of per-element UI types.