36#define NUM_LEDS ((WIDTH) * (HEIGHT))
37#define TIME_ANIMATION 1000
94 if (checkbox.
value()) {
103 Serial.begin(115200);
104 auto screenmap =
xyMap.toScreenMap();
105 screenmap.setDiameter(.2);
107 .setScreenMap(screenmap);
108 auto screenmap2 =
xyMap_Dst.toScreenMap();
109 screenmap.setDiameter(.5);
110 screenmap2.addOffsetY(-
HEIGHT / 2);
112 .setScreenMap(screenmap2);
135 const uint32_t now = millis();
136 uint32_t now_warped =
time_warp.update(now);
139 shape->setScale(
scale.value());
142 static float s_prev_alpha = 0.0f;
150 FASTLED_WARN(
"Transition triggered on " << shape->name());
152 s_prev_alpha = curr_alpha;
156 const CRGB purple =
CRGB(255, 0, 255);
160 float diff = curr_alpha - s_prev_alpha;
162 float factor =
MAX(s_prev_alpha - diff, 0.f);
164 for (
int i = 0; i < number_of_steps; ++i) {
166 fl::map_range<float>(i, 0, number_of_steps - 1, factor, curr_alpha);
169 a = map_range<float>(a, 0.0f, .04f, 0.0f, .04f);
171 float diff_max_alpha =
maxAnimation.value() - curr_alpha;
172 if (diff_max_alpha < 0.94) {
174 a = map_range<float>(a, curr_alpha,
maxAnimation.value(),
178 fl::map_range<uint8_t>(i, 0.0f, number_of_steps - 1, 64, 255);
180 subpixel.
scale(alpha);
182 raster.rasterize(subpixel);
185 s_prev_alpha = curr_alpha;
194 int first =
xyMap(1, 1);
212 for (
int i = 0; i < 10; ++i) {
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.
void push_back(const T &value)
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)
XYMap xyMap_Dst(WIDTH/2, HEIGHT/2, false)
UISlider transition("Transition", 0.0f, 0.0f, 1.0f, 0.01f)
fl::vector< XYPathPtr > shapes
float getAnimationTime(uint32_t now)
XYRaster raster(WIDTH, HEIGHT)
TimeClampedTransition shapeProgress(TIME_ANIMATION)
UICheckbox useWaveFx("Use WaveFX", true)
CRGB leds_downscaled[NUM_LEDS/4]
UISlider whichShape("Which Shape", 0.0f, 0.0f, shapes.size() - 1, 1.0f)
WaveEffect NewWaveSimulation2D(const XYMap &xymap)
UISlider slider("Speed", 0.18f, 0.0f, 1.0f)
InlinedVector< T, INLINED_SIZE > vector_inlined
XYRasterU8Sparse XYRaster
void clear(CRGB(&arr)[N])
void downscaleHalf(const CRGB *src, fl::u16 srcWidth, fl::u16 srcHeight, CRGB *dst)
HeapVector< T, Allocator > vector
Representation of an RGB pixel (Red, Green, Blue)