118 {
119
123
124
128 wave_fx.wave_fx_low->setStencil(stencil);
129 wave_fx.wave_fx_high->setStencil(stencil);
130
132 shape->setScale(
scale.value());
133
135 static float s_prev_alpha = 0.0f;
136
137
139
143 FL_WARN(
"Transition triggered on " << shape->name());
145 s_prev_alpha = curr_alpha;
146 }
147
148
149
150
151 const bool is_active =
152 true || curr_alpha <
maxAnimation.value() && curr_alpha > 0.0f;
153
154
156 frame++;
161
162
163
164 float diff = curr_alpha - s_prev_alpha;
165 diff *= 1.0f;
166 float factor =
fl::max(s_prev_alpha - diff, 0.f);
167
168 for (int i = 0; i < number_of_steps; ++i) {
169 float a =
171 if (a < .04) {
172
173 a = map_range<float>(a, 0.0f, .04f, 0.0f, .04f);
174 }
175 float diff_max_alpha =
maxAnimation.value() - curr_alpha;
176 if (diff_max_alpha < 0.94) {
177
178 a = map_range<float>(a, curr_alpha,
maxAnimation.value(),
180 }
183 if (!is_active) {
184 alpha = 0;
185 }
187 subpixel.
scale(alpha);
188
189 raster.rasterize(subpixel);
190 }
191
192 s_prev_alpha = curr_alpha;
193
194
196 fl::DrawRasterToWaveSimulator draw_wave_fx(&
wave_fx);
198 } else {
200 }
201
202 int first =
xyMap(1, 1);
204
208
210 }
211
214 FL_WARN(
"Frame time: " << frame_time <<
"ms");
215 }
216
218}
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
fl::UISlider scale("Scale", 4,.1, 4,.1)
::fl::DrawContext DrawContext
fl::XYPathPtr getShape(int which)
float getAnimationTime(uint32_t now)
fl::UICheckbox useWaveFx("Use WaveFX", true)
fl::XYRaster raster(WIDTH, HEIGHT)
fl::UIButton trigger("Trigger")
fl::TimeClampedTransition shapeProgress(TIME_ANIMATION)
fl::UISlider maxAnimation("Max Animation", 1.0f, 5.0f, 20.0f, 1.f)
fl::UICheckbox isotropicStencil("Isotropic stencil (rounder ripples)", false)
fl::UISlider whichShape("Which Shape", 0.0f, 0.0f, shapes.size() - 1, 1.0f)
fl::UISlider numberOfSteps("Number of Steps", 32.0f, 1.0f, 100.0f, 1.0f)
#define EVERY_N_SECONDS(N)
Checks whether to execute a block of code every N seconds.
constexpr common_type_t< T, U > max(T a, U b) FL_NOEXCEPT
fl::u32 millis()
Universal millisecond timer - returns milliseconds since system startup.
FASTLED_FORCE_INLINE U map_range(T value, T in_min, T in_max, U out_min, U out_max) FL_NOEXCEPT
Representation of an 8-bit RGB pixel (Red, Green, Blue)