30#define NUM_LEDS ((WIDTH) * (HEIGHT))
31#define IS_SERPINTINE true
32#define TIME_ANIMATION 1000
93 auto screenmap =
xyMap.toScreenMap();
94 screenmap.setDiameter(.2);
115 const uint32_t now = millis();
116 uint32_t now_warped =
time_warp.update(now);
119 shape->setScale(
scale.value());
122 static float s_prev_alpha = 0.0f;
130 FASTLED_WARN(
"Transition triggered on " << shape->name());
132 s_prev_alpha = curr_alpha;
138 const bool is_active =
139 true || curr_alpha <
maxAnimation.value() && curr_alpha > 0.0f;
142 static uint32_t frame = 0;
145 const CRGB purple =
CRGB(255, 0, 255);
151 float diff = curr_alpha - s_prev_alpha;
153 float factor =
MAX(s_prev_alpha - diff, 0.f);
155 for (
int i = 0; i < number_of_steps; ++i) {
162 float diff_max_alpha =
maxAnimation.value() - curr_alpha;
163 if (diff_max_alpha < 0.94) {
174 subpixel.
scale(alpha);
176 raster.rasterize(subpixel);
179 s_prev_alpha = curr_alpha;
189 int first =
xyMap(1, 1);
200 uint32_t frame_time = millis() - now;
UITitle title("Simple control of an xy path")
UIDescription description("This is more of a test for new features.")
fl::vector< XYPathPtr > CreateXYPaths(int width, int height)
UISlider transition("Transition", 0.0f, 0.0f, 1.0f, 0.01f)
UISlider speed("Speed", 1.0f, -20.0f, 20.0f, 0.01f)
TimeClampedTransition shapeProgress(TIME_ANIMATION)
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
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")
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 scale(uint8_t scale)
XYPathPtr getShape(int which)
float getAnimationTime(uint32_t now)
WaveEffect NewWaveSimulation2D(const XYMap xymap)
#define EVERY_N_SECONDS(N)
Checks whether to execute a block of code every N seconds.
XYRasterU8Sparse XYRaster
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)