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

◆ draw()

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

Implements fl::IAnimartrix2Viz.

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

12 {
13 auto *e = ctx.mEngine.get();
14 e->get_ready();
15
16 e->timings.master_speed = 0.01;
17
18 float w = 1;
19
20 e->timings.ratio[0] = 0.01;
21 e->timings.ratio[1] = 0.011;
22 e->timings.ratio[2] = 0.013;
23 e->timings.ratio[3] = 0.33 * w;
24 e->timings.ratio[4] = 0.36 * w;
25 e->timings.ratio[5] = 0.38 * w;
26 e->timings.ratio[6] = 0.0003;
27
28 e->timings.offset[0] = 0;
29 e->timings.offset[1] = 100;
30 e->timings.offset[2] = 200;
31 e->timings.offset[3] = 300;
32 e->timings.offset[4] = 400;
33 e->timings.offset[5] = 500;
34 e->timings.offset[6] = 600;
35
36 e->calculate_oscillators(e->timings);
37
38 for (int x = 0; x < e->num_x; x++) {
39 for (int y = 0; y < e->num_y; y++) {
40
41 float s = 0.4;
42 float r = 1.5;
43
44 e->animation.dist =
45 3 + e->distance[x][y] +
46 3 * fl::sinf(0.25 * e->distance[x][y] - e->move.radial[3]);
47 e->animation.angle = e->polar_theta[x][y] + e->move.noise_angle[0] +
48 e->move.noise_angle[6];
49 e->animation.z = 5;
50 e->animation.scale_x = 0.1 * s;
51 e->animation.scale_y = 0.1 * s;
52 e->animation.offset_z = 10 * e->move.linear[0];
53 e->animation.offset_y = -5 * r * e->move.linear[0];
54 e->animation.offset_x = 10;
55 e->animation.low_limit = 0;
56 e->show1 = e->render_value(e->animation);
57
58 e->animation.dist =
59 4 + e->distance[x][y] +
60 4 * fl::sinf(0.24 * e->distance[x][y] - e->move.radial[4]);
61 e->animation.angle = e->polar_theta[x][y] + e->move.noise_angle[1] +
62 e->move.noise_angle[6];
63 e->animation.z = 5;
64 e->animation.scale_x = 0.1 * s;
65 e->animation.scale_y = 0.1 * s;
66 e->animation.offset_z = 0.1 * e->move.linear[1];
67 e->animation.offset_y = -5 * r * e->move.linear[1];
68 e->animation.offset_x = 100;
69 e->animation.low_limit = 0;
70 e->show2 = e->render_value(e->animation);
71
72 e->animation.dist =
73 5 + e->distance[x][y] +
74 5 * fl::sinf(0.23 * e->distance[x][y] - e->move.radial[5]);
75 e->animation.angle = e->polar_theta[x][y] + e->move.noise_angle[2] +
76 e->move.noise_angle[6];
77 e->animation.z = 5;
78 e->animation.scale_x = 0.1 * s;
79 e->animation.scale_y = 0.1 * s;
80 e->animation.offset_z = 0.1 * e->move.linear[2];
81 e->animation.offset_y = -5 * r * e->move.linear[2];
82 e->animation.offset_x = 1000;
83 e->animation.low_limit = 0;
84 e->show3 = e->render_value(e->animation);
85
86 e->show4 = e->colordodge(e->show1, e->show2);
87
88 float rad = fl::sinf(PI / 2 +
89 e->distance[x][y] / 14);
90
91 CHSV(rad * ((e->show1 + e->show2) + e->show3), 255, 255);
92
93 e->pixel = e->rgb_sanity_check(e->pixel);
94
95 fl::u8 a = e->getTime() / 100;
96 CRGB p = CRGB(CHSV(((a + e->show1 + e->show2) + e->show3), 255, 255));
97 rgb pixel;
98 pixel.red = p.red;
99 pixel.green = p.green;
100 pixel.blue = p.blue;
101 e->setPixelColorInternal(x, y, pixel);
102 }
103 }
104}
#define PI
fl::hsv8 CHSV
Definition chsv.h:11
unsigned char u8
Definition stdint.h:131
fl::CRGB CRGB
Definition video.h:18
float sinf(float value) FL_NO_EXCEPT
Definition math.h:360

References fl::rgb::blue, fl::FL_NO_EXCEPT, fl::rgb::green, PI, fl::rgb::red, fl::sinf(), fl::x, and fl::y.

+ Here is the call graph for this function: