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

◆ draw()

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

Implements fl::IAnimartrix2Viz.

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

12 {
13 auto *e = ctx.mEngine.get();
14 e->get_ready();
15
16 e->timings.master_speed = 0.002;
17 e->timings.ratio[0] = 0.02;
18 e->timings.ratio[1] = 0.03;
19 e->timings.ratio[2] = 0.04;
20 e->timings.ratio[3] = 0.05;
21 e->timings.ratio[4] = 0.6;
22 e->timings.offset[0] = 0;
23 e->timings.offset[1] = 100;
24 e->timings.offset[2] = 200;
25 e->timings.offset[3] = 300;
26 e->timings.offset[4] = 400;
27
28 e->calculate_oscillators(e->timings);
29
30 for (int x = 0; x < e->num_x; x++) {
31 for (int y = 0; y < e->num_y; y++) {
32 e->animation.dist = e->distance[x][y] * (2 + e->move.directional[0]) / 3;
33 e->animation.angle = 2 * e->polar_theta[x][y] +
34 3 * e->move.noise_angle[0] + e->move.radial[4];
35 e->animation.scale_x = 0.1;
36 e->animation.scale_y = 0.1;
37 e->animation.scale_z = 0.1;
38 e->animation.offset_y = 2 * e->move.linear[0];
39 e->animation.offset_x = 0;
40 e->animation.offset_z = 0;
41 e->animation.z = e->move.linear[0];
42 float show1 = e->render_value(e->animation);
43
44 e->animation.dist = e->distance[x][y] * (2 + e->move.directional[1]) / 3;
45 e->animation.angle = 2 * e->polar_theta[x][y] +
46 3 * e->move.noise_angle[1] + e->move.radial[4];
47 e->animation.offset_x = 2 * e->move.linear[1];
48 e->animation.z = e->move.linear[1];
49 float show2 = e->render_value(e->animation);
50
51 e->animation.dist = e->distance[x][y] * (2 + e->move.directional[2]) / 3;
52 e->animation.angle = 2 * e->polar_theta[x][y] +
53 3 * e->move.noise_angle[2] + e->move.radial[4];
54 e->animation.offset_y = 2 * e->move.linear[2];
55 e->animation.z = e->move.linear[2];
56 float show3 = e->render_value(e->animation);
57
58 e->animation.dist = e->distance[x][y] * (2 + e->move.directional[3]) / 3;
59 e->animation.angle = 2 * e->polar_theta[x][y] +
60 3 * e->move.noise_angle[3] + e->move.radial[4];
61 e->animation.offset_x = 2 * e->move.linear[3];
62 e->animation.z = e->move.linear[3];
63 float show4 = e->render_value(e->animation);
64
65 e->pixel.red = show1;
66 e->pixel.green = show3 * e->distance[x][y] / 10;
67 e->pixel.blue = (show2 + show4) / 2;
68
69 e->pixel = e->rgb_sanity_check(e->pixel);
70 e->setPixelColorInternal(x, y, e->pixel);
71 }
72 }
73}

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