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 setColorShift(float speed)
void noisePunchX(float center, float width, float amplitude=1.0f, BumpShape shape=BumpShape::HalfSine)
Trigger a noise punch on the X axis (columns).
void setFlowSpeedX(float speed)
void setFlowSpeedY(float speed)
void noisePunchY(float center, float width, float amplitude=1.0f, BumpShape shape=BumpShape::HalfSine)
Trigger a noise punch on the Y axis (rows).
void setNoiseFrequencyX(float freq)
void setEndpointSpeed(float speed)
void setDotCount(int count)
void setPersistence(float halfLife)
void setFlowAmplitudeX(float amp)
void draw(DrawContext context) override
Handles timing, then delegates to drawImpl().
void setFlowShift(float shift)
void setNoiseFrequencyY(float freq)
void setEmitterMode(int mode)
void setShowFlowVectors(bool show)
void setFlowAmplitudeY(float amp)
Pure fixed-point (s16x16) flow field implementation for maximum speed.
Float-precision flow field implementation.
Abstract base class for 2D flow field effects.
::fl::DrawContext DrawContext
2D flow field visualization: emitters paint color, noise advects it
LIB8STATIC fl::u8 random8() FL_NOEXCEPT
Generate an 8-bit random number.
Aggregator header for the fl/ui/ family of per-element UI types.