35#define NUM_LEDS ((WIDTH) * (HEIGHT))
36#define IS_SERPINTINE true
37#define TIME_ANIMATION 1000
121 const uint32_t now = millis();
122 uint32_t now_warped =
time_warp.update(now);
128 wave_fx.wave_fx_low->setStencil(stencil);
129 wave_fx.wave_fx_high->setStencil(stencil);
132 shape->setScale(
scale.value());
135 static float s_prev_alpha = 0.0f;
143 FL_WARN(
"Transition triggered on " << shape->name());
145 s_prev_alpha = curr_alpha;
151 const bool is_active =
152 true || curr_alpha <
maxAnimation.value() && curr_alpha > 0.0f;
155 static uint32_t frame = 0;
164 float diff = curr_alpha - s_prev_alpha;
166 float factor =
fl::max(s_prev_alpha - diff, 0.f);
168 for (
int i = 0; i < number_of_steps; ++i) {
173 a = map_range<float>(a, 0.0f, .04f, 0.0f, .04f);
175 float diff_max_alpha =
maxAnimation.value() - curr_alpha;
176 if (diff_max_alpha < 0.94) {
178 a = map_range<float>(a, curr_alpha,
maxAnimation.value(),
187 subpixel.
scale(alpha);
189 raster.rasterize(subpixel);
192 s_prev_alpha = curr_alpha;
196 fl::DrawRasterToWaveSimulator draw_wave_fx(&
wave_fx);
202 int first =
xyMap(1, 1);
213 uint32_t frame_time = millis() - now;
214 FL_WARN(
"Frame time: " << frame_time <<
"ms");
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
fl::XYPathPtr getShape(int which)
fl::UICheckbox useWaveFx("Use WaveFX", true)
fl::XYRaster raster(WIDTH, HEIGHT)
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::UICheckbox useWaveFx("Use WaveFX", true)
fl::XYRaster raster(WIDTH, HEIGHT)
fl::vector< fl::XYPathPtr > shapes
fl::UISlider transition("Transition", 0.0f, 0.0f, 1.0f, 0.01f)
fl::UIButton trigger("Trigger")
fl::TimeClampedTransition shapeProgress(TIME_ANIMATION)
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)
#define EVERY_N_SECONDS(N)
Checks whether to execute a block of code every N seconds.
constexpr common_type_t< T, U > max(T a, U b) FL_NOEXCEPT
XYRasterU8Sparse XYRaster
FASTLED_FORCE_INLINE U map_range(T value, T in_min, T in_max, U out_min, U out_max) FL_NOEXCEPT
void * memset(void *s, int c, size_t n) FL_NOEXCEPT
Representation of an 8-bit RGB pixel (Red, Green, Blue)
Aggregator header for the fl/ui/ family of per-element UI types.