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

◆ draw()

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

Implements fl::IAnimartrix2Viz.

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

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

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

+ Here is the call graph for this function: