21#include "fl/bilinear_compression.h"
31#define NUM_LEDS ((WIDTH) * (HEIGHT))
32#define TIME_ANIMATION 1000
95 auto screenmap =
xyMap.toScreenMap();
96 screenmap.setDiameter(.2);
98 auto screenmap2 =
xyMap_Dst.toScreenMap();
99 screenmap.setDiameter(.5);
100 screenmap2.addOffsetY(-
HEIGHT / 2);
102 .setScreenMap(screenmap2);
125 const uint32_t now = millis();
126 uint32_t now_warped =
time_warp.update(now);
129 shape->setScale(
scale.value());
132 static float s_prev_alpha = 0.0f;
140 FASTLED_WARN(
"Transition triggered on " << shape->name());
142 s_prev_alpha = curr_alpha;
145 const bool is_active =
146 true || curr_alpha <
maxAnimation.value() && curr_alpha > 0.0f;
148 static uint32_t frame = 0;
151 const CRGB purple =
CRGB(255, 0, 255);
155 float diff = curr_alpha - s_prev_alpha;
157 float factor =
MAX(s_prev_alpha - diff, 0.f);
159 for (
int i = 0; i < number_of_steps; ++i) {
166 float diff_max_alpha =
maxAnimation.value() - curr_alpha;
167 if (diff_max_alpha < 0.94) {
178 subpixel.
scale(alpha);
180 raster.rasterize(subpixel);
183 s_prev_alpha = curr_alpha;
193 int first =
xyMap(1, 1);
211 for (
int i = 0; i < 10; ++i) {
UISlider transition("Transition", 0.0f, 0.0f, 1.0f, 0.01f)
UIDescription description("Use a path on the WaveFx")
UISlider speed("Speed", 1.0f, -20.0f, 20.0f, 0.01f)
TimeClampedTransition shapeProgress(TIME_ANIMATION)
XYPathPtr getShape(int which)
UITitle title("XYPath Demo")
XYMap xyMap_Dst(WIDTH/2, HEIGHT/2, false)
XYMap xyMap(WIDTH, HEIGHT, false)
UICheckbox useWaveFx("Use WaveFX", true)
UISlider numberOfSteps("Number of Steps", 32.0f, 1.0f, 100.0f, 1.0f)
UISlider scale("Scale", 1.0f, 0.0f, 1.0f, 0.01f)
XYRaster raster(WIDTH, HEIGHT)
fl::vector< XYPathPtr > shapes
float getAnimationTime(uint32_t now)
UISlider whichShape("Which Shape", 0.0f, 0.0f, shapes.size() - 1, 1.0f)
UISlider maxAnimation("Max Animation", 1.0f, 5.0f, 20.0f, 1.f)
UIButton trigger("Trigger")
CRGB leds_downscaled[NUM_LEDS/4]
CFastLED FastLED
Global LED strip management instance.
central include file for FastLED, defines the CFastLED class/object
LED controller for WS2812 LEDs with GRB color order.
void push_back(const T &value)
void scale(uint8_t scale)
WaveEffect NewWaveSimulation2D(const XYMap xymap)
InlinedVector< T, INLINED_SIZE > vector_inlined
XYRasterU8Sparse XYRaster
void clear(CRGB(&arr)[N])
void downscaleHalf(const CRGB *src, uint16_t srcWidth, uint16_t srcHeight, CRGB *dst)
FASTLED_FORCE_INLINE U map_range(T value, T in_min, T in_max, U out_min, U out_max)
Implements a simple red square effect for 2D LED grids.
Representation of an RGB pixel (Red, Green, Blue)
fl::vector< XYPathPtr > CreateXYPaths(int width, int height)