36#define NUM_LEDS ((WIDTH) * (HEIGHT))
37#define IS_SERPINTINE true
38#define TIME_ANIMATION 1000
99 auto screenmap =
xyMap.toScreenMap();
100 screenmap.setDiameter(.2);
121 const uint32_t now = millis();
122 uint32_t now_warped =
time_warp.update(now);
125 shape->setScale(
scale.value());
128 static float s_prev_alpha = 0.0f;
136 FASTLED_WARN(
"Transition triggered on " << shape->name());
138 s_prev_alpha = curr_alpha;
144 const bool is_active =
145 true || curr_alpha <
maxAnimation.value() && curr_alpha > 0.0f;
148 static uint32_t frame = 0;
151 const CRGB purple =
CRGB(255, 0, 255);
157 float diff = curr_alpha - s_prev_alpha;
159 float factor =
MAX(s_prev_alpha - diff, 0.f);
161 for (
int i = 0; i < number_of_steps; ++i) {
163 fl::map_range<float>(i, 0, number_of_steps - 1, factor, curr_alpha);
166 a = map_range<float>(a, 0.0f, .04f, 0.0f, .04f);
168 float diff_max_alpha =
maxAnimation.value() - curr_alpha;
169 if (diff_max_alpha < 0.94) {
171 a = map_range<float>(a, curr_alpha,
maxAnimation.value(),
175 fl::map_range<float>(i, 0.0f, number_of_steps - 1, 64, 255);
180 subpixel.
scale(alpha);
182 raster.rasterize(subpixel);
185 s_prev_alpha = curr_alpha;
195 int first =
xyMap(1, 1);
206 uint32_t frame_time = millis() - now;
fl::vector< XYPathPtr > CreateXYPaths(int width, int height)
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS 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.
UISlider numberOfSteps("Number of Steps", 32.0f, 1.0f, 100.0f, 1.0f)
UIButton trigger("Trigger")
UITitle title("XYPath Demo")
XYPathPtr getShape(int which)
UIDescription description("Use a path on the WaveFx")
UISlider maxAnimation("Max Animation", 1.0f, 5.0f, 20.0f, 1.f)
UISlider transition("Transition", 0.0f, 0.0f, 1.0f, 0.01f)
float getAnimationTime(uint32_t now)
XYRaster raster(WIDTH, HEIGHT)
TimeClampedTransition shapeProgress(TIME_ANIMATION)
UICheckbox useWaveFx("Use WaveFX", true)
UISlider whichShape("Which Shape", 0.0f, 0.0f, shapes.size() - 1, 1.0f)
UISlider numberOfSteps("Number of Steps", 32.0f, 1.0f, 100.0f, 1.0f)
UIButton trigger("Trigger")
UISlider maxAnimation("Max Animation", 1.0f, 5.0f, 20.0f, 1.f)
UISlider transition("Transition", 0.0f, 0.0f, 1.0f, 0.01f)
fl::vector< XYPathPtr > shapes
XYRaster raster(WIDTH, HEIGHT)
TimeClampedTransition shapeProgress(TIME_ANIMATION)
UICheckbox useWaveFx("Use WaveFX", true)
UISlider whichShape("Which Shape", 0.0f, 0.0f, shapes.size() - 1, 1.0f)
WaveEffect NewWaveSimulation2D(const XYMap &xymap)
#define EVERY_N_SECONDS(N)
Checks whether to execute a block of code every N seconds.
XYRasterU8Sparse XYRaster
void * memfill(void *ptr, int value, fl::size num)
HeapVector< T, Allocator > vector
Representation of an RGB pixel (Red, Green, Blue)