34#define NUM_LEDS ((WIDTH) * (HEIGHT))
35#define TIME_ANIMATION 1000
93 if (checkbox.
value()) {
107 auto screenmap2 =
xyMap_Dst.toScreenMap();
109 screenmap2.addOffsetY(-
HEIGHT / 2);
111 .setScreenMap(screenmap2);
135 uint32_t now_warped =
time_warp.update(now);
141 wave_fx.wave_fx_low->setStencil(stencil);
142 wave_fx.wave_fx_high->setStencil(stencil);
145 shape->setScale(
scale.value());
148 static float s_prev_alpha = 0.0f;
156 FL_WARN(
"Transition triggered on " << shape->name());
158 s_prev_alpha = curr_alpha;
166 float diff = curr_alpha - s_prev_alpha;
168 float factor =
fl::max(s_prev_alpha - diff, 0.f);
170 for (
int i = 0; i < number_of_steps; ++i) {
177 float diff_max_alpha =
maxAnimation.value() - curr_alpha;
178 if (diff_max_alpha < 0.94) {
186 subpixel.
scale(alpha);
188 raster.rasterize(subpixel);
191 s_prev_alpha = curr_alpha;
200 int first =
xyMap(1, 1);
218 for (
int i = 0; i < 10; ++i) {
fl::UIDescription description("Demo of the Animatrix effects. @author of fx is StefanPetrick")
fl::UITitle title("Animartrix")
WaveEffect NewWaveSimulation2D(const fl::XYMap &xymap)
fl::vector< fl::XYPathPtr > CreateXYPaths(int width, int height)
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
fl::UISlider scale("Scale", 4,.1, 4,.1)
::fl::DrawContext DrawContext
bool value() const FL_NOEXCEPT
void push_back(const T &value) FL_NOEXCEPT
fl::XYPathPtr getShape(int which)
fl::UICheckbox useWaveFx("Use WaveFX", true)
fl::XYMap xyMap_Dst(WIDTH/2, HEIGHT/2, false)
fl::XYRaster raster(WIDTH, HEIGHT)
fl::vector< fl::XYPathPtr > shapes
fl::CRGB leds_downscaled[NUM_LEDS/4]
fl::UISlider transition("Transition", 0.0f, 0.0f, 1.0f, 0.01f)
fl::UIButton trigger("Trigger")
fl::TimeClampedTransition shapeProgress(TIME_ANIMATION)
float getAnimationTime(uint32_t now)
fl::UISlider maxAnimation("Max Animation", 1.0f, 5.0f, 20.0f, 1.f)
fl::UICheckbox isotropicStencil("Isotropic stencil (rounder ripples)", false)
fl::UISlider whichShape("Which Shape", 0.0f, 0.0f, shapes.size() - 1, 1.0f)
fl::UISlider numberOfSteps("Number of Steps", 32.0f, 1.0f, 100.0f, 1.0f)
fl::UISlider slider("Speed", 0.18f, 0.0f, 1.0f)
constexpr common_type_t< T, U > max(T a, U b) FL_NOEXCEPT
XYRasterU8Sparse XYRaster
void clear(CRGB(&arr)[N])
fl::u32 millis()
Universal millisecond timer - returns milliseconds since system startup.
FASTLED_FORCE_INLINE U map_range(T value, T in_min, T in_max, U out_min, U out_max) FL_NOEXCEPT
VectorN< T, INLINED_SIZE > vector_inlined
Representation of an 8-bit RGB pixel (Red, Green, Blue)
Aggregator header for the fl/ui/ family of per-element UI types.