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

◆ draw()

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

Implements fl::IAnimartrix2Viz.

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

12 {
13 auto *e = ctx.mEngine.get();
14 e->get_ready();
15
16 e->timings.master_speed = 0.000001;
17 e->timings.ratio[0] = 0.4;
18 e->timings.ratio[1] = 0.32;
19 e->timings.ratio[2] = 0.10;
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 = 0.3 * e->distance[x][y] * 0.8;
33 e->animation.angle = 3 * e->polar_theta[x][y] + e->move.radial[2];
34 e->animation.scale_x = 0.1 + (e->move.noise_angle[0]) / 10;
35 e->animation.scale_y = 0.1 + (e->move.noise_angle[1]) / 10;
36 e->animation.scale_z = 0.01;
37 e->animation.offset_y = 0;
38 e->animation.offset_x = 0;
39 e->animation.offset_z = 100 * e->move.linear[0];
40 e->animation.z = 30;
41 float show1 = e->render_value(e->animation);
42
43 e->animation.angle = 3;
44 float show2 = e->render_value(e->animation);
45
46 float dist = 1;
47 e->pixel.red = show1 * dist;
48 e->pixel.green = (show1 - show2) * dist * 0.3;
49 e->pixel.blue = (show2 - show1) * dist;
50
51 if (e->distance[x][y] > 16) {
52 e->pixel.red = 0;
53 e->pixel.green = 0;
54 e->pixel.blue = 0;
55 }
56
57 e->pixel = e->rgb_sanity_check(e->pixel);
58 e->setPixelColorInternal(x, y, e->pixel);
59 }
60 }
61}

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