FastLED 3.9.15
Loading...
Searching...
No Matches

◆ draw()

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

Implements fl::IAnimartrix2Viz.

Definition at line 11 of file polar_waves.cpp.hpp.

11 {
12 auto *e = ctx.mEngine.get();
13 e->get_ready();
14
15 e->timings.master_speed = 0.5;
16 e->timings.ratio[0] = 0.0025;
17 e->timings.ratio[1] = 0.0027;
18 e->timings.ratio[2] = 0.0031;
19
20 e->calculate_oscillators(e->timings);
21
22 for (int x = 0; x < e->num_x; x++) {
23 for (int y = 0; y < e->num_y; y++) {
24 e->animation.dist = (e->distance[x][y]);
25 e->animation.angle =
26 e->polar_theta[x][y] - e->animation.dist * 0.1 + e->move.radial[0];
27 e->animation.z = (e->animation.dist * 1.5) - 10 * e->move.linear[0];
28 e->animation.scale_x = 0.15;
29 e->animation.scale_y = 0.15;
30 e->animation.offset_x = e->move.linear[0];
31
32 float show1 = e->render_value(e->animation);
33 e->animation.angle =
34 e->polar_theta[x][y] - e->animation.dist * 0.1 + e->move.radial[1];
35 e->animation.z = (e->animation.dist * 1.5) - 10 * e->move.linear[1];
36 e->animation.offset_x = e->move.linear[1];
37
38 float show2 = e->render_value(e->animation);
39 e->animation.angle =
40 e->polar_theta[x][y] - e->animation.dist * 0.1 + e->move.radial[2];
41 e->animation.z = (e->animation.dist * 1.5) - 10 * e->move.linear[2];
42 e->animation.offset_x = e->move.linear[2];
43
44 float show3 = e->render_value(e->animation);
45
46 float radius = e->radial_filter_radius;
47 float radial = (radius - e->distance[x][y]) / e->distance[x][y];
48
49 e->pixel.red = radial * show1;
50 e->pixel.green = radial * show2;
51 e->pixel.blue = radial * show3;
52
53 e->pixel = e->rgb_sanity_check(e->pixel);
54 e->setPixelColorInternal(x, y, e->pixel);
55 }
56 }
57}

References fl::Context::mEngine, fl::x, and fl::y.