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

◆ draw()

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

Implements fl::IAnimartrix2Viz.

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

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

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