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

◆ draw()

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

Implements fl::IAnimartrix2Viz.

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

11 {
12 auto *e = ctx.mEngine.get();
13 e->get_ready();
14
15 e->timings.master_speed = 0.03;
16 e->timings.ratio[0] = 0.025;
17 e->timings.ratio[1] = 0.027;
18 e->timings.ratio[2] = 0.031;
19 e->timings.ratio[3] = 0.0053;
20 e->timings.ratio[4] = 0.0056;
21 e->timings.ratio[5] = 0.0059;
22
23 e->calculate_oscillators(e->timings);
24
25 for (int x = 0; x < e->num_x; x++) {
26 for (int y = 0; y < e->num_y; y++) {
27
28 float s = 0.7;
29
30 e->animation.dist = e->distance[x][y] * (e->move.directional[0]) * s;
31 e->animation.angle = e->polar_theta[x][y] + e->move.radial[0];
32 e->animation.z = 5;
33 e->animation.scale_x = 0.09;
34 e->animation.scale_y = 0.09;
35 e->animation.offset_z = 5 * e->move.linear[0];
36 e->animation.offset_x = 0;
37 e->animation.offset_y = 0;
38 float show1 = e->render_value(e->animation);
39
40 e->animation.dist = e->distance[x][y] * e->move.directional[1] * s;
41 e->animation.angle = e->polar_theta[x][y] + e->move.radial[1];
42 e->animation.z = 50;
43 e->animation.scale_x = 0.07;
44 e->animation.scale_y = 0.07;
45 e->animation.offset_z = 5 * e->move.linear[1];
46 e->animation.offset_x = 0;
47 e->animation.offset_y = 0;
48 float show2 = e->render_value(e->animation);
49
50 e->animation.dist = e->distance[x][y] * e->move.directional[2] * s;
51 e->animation.angle = e->polar_theta[x][y] + e->move.radial[2];
52 e->animation.z = 500;
53 e->animation.scale_x = 0.05;
54 e->animation.scale_y = 0.05;
55 e->animation.offset_z = 5 * e->move.linear[2];
56 e->animation.offset_x = 0;
57 e->animation.offset_y = 0;
58 float show3 = e->render_value(e->animation);
59
60 e->animation.dist = e->distance[x][y] * (e->move.directional[3]) * s;
61 e->animation.angle = e->polar_theta[x][y] + e->move.radial[3];
62 e->animation.z = 5;
63 e->animation.scale_x = 0.09;
64 e->animation.scale_y = 0.09;
65 e->animation.offset_z = 5 * e->move.linear[3];
66 e->animation.offset_x = 0;
67 e->animation.offset_y = 0;
68 float show4 = e->render_value(e->animation);
69
70 e->animation.dist = e->distance[x][y] * e->move.directional[4] * s;
71 e->animation.angle = e->polar_theta[x][y] + e->move.radial[4];
72 e->animation.z = 50;
73 e->animation.scale_x = 0.07;
74 e->animation.scale_y = 0.07;
75 e->animation.offset_z = 5 * e->move.linear[4];
76 e->animation.offset_x = 0;
77 e->animation.offset_y = 0;
78 float show5 = e->render_value(e->animation);
79
80 e->animation.dist = e->distance[x][y] * e->move.directional[5] * s;
81 e->animation.angle = e->polar_theta[x][y] + e->move.radial[5];
82 e->animation.z = 500;
83 e->animation.scale_x = 0.05;
84 e->animation.scale_y = 0.05;
85 e->animation.offset_z = 5 * e->move.linear[5];
86 e->animation.offset_x = 0;
87 e->animation.offset_y = 0;
88 float show6 = e->render_value(e->animation);
89
90 float radius = e->radial_filter_radius;
91 float radial = (radius - e->distance[x][y]) / e->distance[x][y];
92
93 e->show7 = e->screen(show1, show4);
94 e->show8 = e->colordodge(show2, show5);
95 e->show9 = e->screen(show3, show6);
96
97 e->pixel.red = radial * (e->show7 + e->show8);
98 e->pixel.green = 0;
99 e->pixel.blue = radial * e->show9;
100
101 e->pixel = e->rgb_sanity_check(e->pixel);
102
103 e->setPixelColorInternal(x, y, e->pixel);
104 }
105 }
106}

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