FastLED 3.10.8
Loading...
Searching...
No Matches

◆ draw()

void fl::Module_Experiment8_FP::draw ( Context & ctx)
overridevirtual

Implements fl::IAnimartrix2Viz.

Definition at line 107 of file module_experiment8.cpp.hpp.

107 {
108 auto *e = ctx.mEngine.get();
109 e->get_ready();
110 mState.ensureCache(e);
111 const fl::i32 *fade_lut = fl::assume_aligned<16>(mState.fade_lut);
112 const fl::u8 *perm = PERLIN_NOISE;
113
114 e->timings.master_speed = 0.01;
115
116 float w = 0.3;
117
118 e->timings.ratio[0] = 0.01;
119 e->timings.ratio[1] = 0.011;
120 e->timings.ratio[2] = 0.013;
121 e->timings.ratio[3] = 0.33 * w;
122 e->timings.ratio[4] = 0.36 * w;
123 e->timings.ratio[5] = 0.38 * w;
124 e->timings.ratio[6] = 0.0003;
125
126 e->timings.offset[0] = 0;
127 e->timings.offset[1] = 100;
128 e->timings.offset[2] = 200;
129 e->timings.offset[3] = 300;
130 e->timings.offset[4] = 400;
131 e->timings.offset[5] = 500;
132 e->timings.offset[6] = 600;
133
134 e->calculate_oscillators(e->timings);
135
136 for (int x = 0; x < e->num_x; x++) {
137 for (int y = 0; y < e->num_y; y++) {
138
139 float s = 0.4;
140 float r = 1.5;
141
142 e->animation.dist =
143 3 + e->distance[x][y] +
144 3 * fl::sinf(0.25 * e->distance[x][y] - e->move.radial[3]);
145 e->animation.angle = e->polar_theta[x][y] + e->move.noise_angle[0] +
146 e->move.noise_angle[6];
147 e->animation.z = 5;
148 e->animation.scale_x = 0.1 * s;
149 e->animation.scale_y = 0.1 * s;
150 e->animation.offset_z = 10 * e->move.linear[0];
151 e->animation.offset_y = -5 * r * e->move.linear[0];
152 e->animation.offset_x = 10;
153 e->animation.low_limit = 0;
154 e->show1 = render_value_fp_from_float(e->animation, fade_lut, perm);
155
156 e->animation.dist =
157 4 + e->distance[x][y] +
158 4 * fl::sinf(0.24 * e->distance[x][y] - e->move.radial[4]);
159 e->animation.angle = e->polar_theta[x][y] + e->move.noise_angle[1] +
160 e->move.noise_angle[6];
161 e->animation.z = 5;
162 e->animation.scale_x = 0.1 * s;
163 e->animation.scale_y = 0.1 * s;
164 e->animation.offset_z = 0.1 * e->move.linear[1];
165 e->animation.offset_y = -5 * r * e->move.linear[1];
166 e->animation.offset_x = 100;
167 e->animation.low_limit = 0;
168 e->show2 = render_value_fp_from_float(e->animation, fade_lut, perm);
169
170 e->animation.dist =
171 5 + e->distance[x][y] +
172 5 * fl::sinf(0.23 * e->distance[x][y] - e->move.radial[5]);
173 e->animation.angle = e->polar_theta[x][y] + e->move.noise_angle[2] +
174 e->move.noise_angle[6];
175 e->animation.z = 5;
176 e->animation.scale_x = 0.1 * s;
177 e->animation.scale_y = 0.1 * s;
178 e->animation.offset_z = 0.1 * e->move.linear[2];
179 e->animation.offset_y = -5 * r * e->move.linear[2];
180 e->animation.offset_x = 1000;
181 e->animation.low_limit = 0;
182 e->show3 = render_value_fp_from_float(e->animation, fade_lut, perm);
183
184 e->show4 = e->colordodge(e->show1, e->show2);
185
186 float rad = fl::sinf(PI / 2 +
187 e->distance[x][y] / 14);
188
189 e->pixel.red = rad * ((e->show1 + e->show2) + e->show3);
190 e->pixel.green = (((e->show2 + e->show3) * 0.8) - 90) * rad;
191 e->pixel.blue = e->show4 * 0.2;
192
193 e->pixel = e->rgb_sanity_check(e->pixel);
194
195 e->setPixelColorInternal(x, y, e->pixel);
196 }
197 }
198}
#define PI
T * assume_aligned(T *ptr) FL_NO_EXCEPT
Definition s16x16x4.h:126
unsigned char u8
Definition stdint.h:131
FASTLED_FORCE_INLINE fl::i32 render_value_fp_from_float(const render_parameters &anim, const fl::i32 *fade_lut, const fl::u8 *perm) FL_NO_EXCEPT
float sinf(float value) FL_NO_EXCEPT
Definition math.h:360

References fl::fl::assume_aligned(), fl::FL_NO_EXCEPT, mState, PI, fl::render_value_fp_from_float(), fl::sinf(), fl::x, and fl::y.

+ Here is the call graph for this function: