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

◆ draw()

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

Implements fl::IAnimartrix2Viz.

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

11 {
12 auto *e = ctx.mEngine.get();
13 e->get_ready();
14
15 e->timings.master_speed = 0.003;
16 e->timings.ratio[0] = 0.025;
17 e->timings.ratio[1] = 0.027;
18 e->timings.ratio[2] = 0.029;
19 e->timings.ratio[3] = 0.033;
20 e->timings.ratio[4] = 0.037;
21 e->timings.ratio[5] = 0.15;
22 e->timings.ratio[6] = 0.41;
23
24 e->calculate_oscillators(e->timings);
25
26 for (int x = 0; x < e->num_x; x++) {
27 for (int y = 0; y < e->num_y; y++) {
28
29 float s = 4;
30 float f = 10 + 2 * e->move.directional[0];
31
32 e->animation.dist = (f + e->move.directional[0]) *
33 fl::sinf(-e->move.radial[5] + e->move.radial[0] +
34 (e->distance[x][y] / (s)));
35 e->animation.angle = 1 * e->polar_theta[x][y];
36 e->animation.z = 5;
37 e->animation.scale_x = 0.1;
38 e->animation.scale_y = 0.1;
39 e->animation.offset_z = -10;
40 e->animation.offset_y = 20 * e->move.linear[0];
41 e->animation.offset_x = 10;
42 e->animation.low_limit = 0;
43 e->show2 = e->render_value(e->animation);
44
45 e->animation.dist = (f + e->move.directional[1]) *
46 fl::sinf(-e->move.radial[5] + e->move.radial[1] +
47 (e->distance[x][y] / (s)));
48 e->animation.angle = 1 * e->polar_theta[x][y];
49 e->animation.z = 500;
50 e->animation.scale_x = 0.1;
51 e->animation.scale_y = 0.1;
52 e->animation.offset_z = -10;
53 e->animation.offset_y = 20 * e->move.linear[1];
54 e->animation.offset_x = 10;
55 e->animation.low_limit = 0;
56 e->show3 = e->render_value(e->animation);
57
58 e->animation.dist = (f + e->move.directional[2]) *
59 fl::sinf(-e->move.radial[5] + e->move.radial[2] +
60 (e->distance[x][y] / (s)));
61 e->animation.angle = 1 * e->polar_theta[x][y];
62 e->animation.z = 5000;
63 e->animation.scale_x = 0.1;
64 e->animation.scale_y = 0.1;
65 e->animation.offset_z = -10;
66 e->animation.offset_y = 20 * e->move.linear[2];
67 e->animation.offset_x = 10;
68 e->animation.low_limit = 0;
69 e->show4 = e->render_value(e->animation);
70
71 e->animation.dist = (f + e->move.directional[3]) *
72 fl::sinf(-e->move.radial[5] + e->move.radial[3] +
73 (e->distance[x][y] / (s)));
74 e->animation.angle = 1 * e->polar_theta[x][y];
75 e->animation.z = 2000;
76 e->animation.scale_x = 0.1;
77 e->animation.scale_y = 0.1;
78 e->animation.offset_z = -10;
79 e->animation.offset_y = 20 * e->move.linear[3];
80 e->animation.offset_x = 10;
81 e->animation.low_limit = 0;
82 e->show5 = e->render_value(e->animation);
83
84 e->show6 = e->screen(e->show4, e->show5);
85 e->show7 = e->screen(e->show2, e->show3);
86
87 float radius = 40;
88 float radial = (radius - e->distance[x][y]) / radius;
89
90 e->pixel.red = e->pixel.blue - 40;
91 e->pixel.green = 0;
92 e->pixel.blue = (0.3 * e->show6 + 0.7 * e->show7) * radial;
93
94 e->pixel = e->rgb_sanity_check(e->pixel);
95
96 e->setPixelColorInternal(x, y, e->pixel);
97 }
98 }
99}
float sinf(float value) FL_NOEXCEPT
Definition math.h:352

References fl::Context::mEngine, fl::sinf(), fl::x, and fl::y.

+ Here is the call graph for this function: