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

◆ draw()

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

Implements fl::IAnimartrix2Viz.

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

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

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

+ Here is the call graph for this function: