118 {
119
121 const uint32_t now = millis();
122 uint32_t now_warped =
time_warp.update(now);
123
125 shape->setScale(
scale.value());
126
128 static float s_prev_alpha = 0.0f;
129
130
132
136 FASTLED_WARN(
"Transition triggered on " << shape->name());
138 s_prev_alpha = curr_alpha;
139 }
140
141
142
143
144 const bool is_active =
145 true || curr_alpha <
maxAnimation.value() && curr_alpha > 0.0f;
146
147
148 static uint32_t frame = 0;
149 frame++;
151 const CRGB purple =
CRGB(255, 0, 255);
154
155
156
157 float diff = curr_alpha - s_prev_alpha;
158 diff *= 1.0f;
159 float factor =
MAX(s_prev_alpha - diff, 0.f);
160
161 for (int i = 0; i < number_of_steps; ++i) {
162 float a =
163 fl::map_range<float>(i, 0, number_of_steps - 1, factor, curr_alpha);
164 if (a < .04) {
165
166 a = map_range<float>(a, 0.0f, .04f, 0.0f, .04f);
167 }
168 float diff_max_alpha =
maxAnimation.value() - curr_alpha;
169 if (diff_max_alpha < 0.94) {
170
171 a = map_range<float>(a, curr_alpha,
maxAnimation.value(),
173 }
174 uint8_t alpha =
175 fl::map_range<float>(i, 0.0f, number_of_steps - 1, 64, 255);
176 if (!is_active) {
177 alpha = 0;
178 }
180 subpixel.
scale(alpha);
181
182 raster.rasterize(subpixel);
183 }
184
185 s_prev_alpha = curr_alpha;
186
187
191 } else {
193 }
194
195 int first =
xyMap(1, 1);
197
201
203 }
204
206 uint32_t frame_time = millis() - now;
208 }
209
211}
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
XYPathPtr getShape(int which)
float getAnimationTime(uint32_t now)
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)
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)
#define EVERY_N_SECONDS(N)
Checks whether to execute a block of code every N seconds.
Representation of an RGB pixel (Red, Green, Blue)