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

◆ draw()

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

Implements fl::IAnimartrix2Viz.

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

12 {
13 auto *e = ctx.mEngine.get();
14 e->get_ready();
15
16 e->timings.master_speed = 0.01;
17 e->timings.ratio[0] = 0.2;
18 e->timings.ratio[1] = 0.13;
19 e->timings.ratio[2] = 0.012;
20
21 e->timings.offset[1] = 100;
22 e->timings.offset[2] = 200;
23 e->timings.offset[3] = 300;
24
25 e->calculate_oscillators(e->timings);
26
27 for (int x = 0; x < e->num_x; x++) {
28 for (int y = 0; y < e->num_y; y++) {
29 e->animation.dist = fl::powf(e->distance[x][y], 0.5f);
30 e->animation.angle = e->polar_theta[x][y] + e->move.radial[0];
31 e->animation.scale_x = 0.07;
32 e->animation.scale_y = 0.07;
33 e->animation.scale_z = 0.1;
34 e->animation.offset_y = e->move.linear[0];
35 e->animation.offset_x = 0;
36 e->animation.offset_z = 0;
37 e->animation.z = 0;
38 float show1 = e->render_value(e->animation);
39
40 e->animation.dist = fl::powf(e->distance[x][y], 0.6f);
41 e->animation.angle = e->polar_theta[x][y] + e->move.noise_angle[2];
42 e->animation.scale_x = 0.07;
43 e->animation.scale_y = 0.07;
44 e->animation.scale_z = 0.1;
45 e->animation.offset_y = e->move.linear[1];
46 e->animation.offset_x = 0;
47 e->animation.offset_z = 0;
48 e->animation.z = 0;
49 float show2 = e->render_value(e->animation);
50
51 e->pixel.red = show1 + show2;
52 e->pixel.green = show2;
53 e->pixel.blue = 0;
54
55 e->pixel = e->rgb_sanity_check(e->pixel);
56 e->setPixelColorInternal(x, y, e->pixel);
57 }
58 }
59}
float powf(float base, float exponent) FL_NO_EXCEPT
Definition math.h:444

References fl::FL_NO_EXCEPT, fl::powf(), fl::x, and fl::y.

+ Here is the call graph for this function: