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

◆ draw()

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

Implements fl::IAnimartrix2Viz.

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

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

References fl::FL_NO_EXCEPT, fl::x, and fl::y.