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

◆ draw()

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

Implements fl::IAnimartrix2Viz.

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

12 {
13 auto *e = ctx.mEngine.get();
14 e->get_ready();
15
16 e->timings.master_speed = 0.02;
17 e->timings.ratio[0] = 0.0025;
18 e->timings.ratio[1] = 0.0027;
19 e->timings.ratio[2] = 0.0031;
20 e->timings.ratio[3] = 0.0033;
21 e->timings.ratio[4] = 0.0036;
22 e->timings.ratio[5] = 0.0039;
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 e->animation.dist = e->distance[x][y] + e->move.noise_angle[4];
29 e->animation.angle = e->polar_theta[x][y] + e->move.radial[0] +
30 e->move.noise_angle[0] + e->move.noise_angle[3] +
31 e->move.noise_angle[1];
32 e->animation.z = 3 + fl::sqrtf(e->animation.dist);
33 e->animation.scale_x = 0.05;
34 e->animation.scale_y = 0.05;
35 e->animation.offset_z = 10;
36 e->animation.offset_x = 50 * e->move.linear[0];
37 float show1 = e->render_value(e->animation);
38
39 e->animation.angle = e->polar_theta[x][y] + e->move.radial[1] +
40 e->move.noise_angle[1] + e->move.noise_angle[4] +
41 e->move.noise_angle[2];
42 e->animation.offset_x = 50 * e->move.linear[1];
43 e->animation.offset_z = 100;
44 float show2 = e->render_value(e->animation);
45
46 e->animation.angle = e->polar_theta[x][y] + e->move.radial[2] +
47 e->move.noise_angle[2] + e->move.noise_angle[5] +
48 e->move.noise_angle[3];
49 e->animation.offset_x = 50 * e->move.linear[2];
50 e->animation.offset_z = 300;
51 float show3 = e->render_value(e->animation);
52
53 float radius = 23;
54 float radial = (radius - e->distance[x][y]) / e->distance[x][y];
55
56 e->pixel.red = radial * (show1 + show3) * 0.5 * e->animation.dist / 5;
57 e->pixel.green = radial * (show2 + show1) * 0.5 * y / 15;
58 e->pixel.blue = radial * (show3 + show2) * 0.5 * x / 15;
59
60 e->pixel = e->rgb_sanity_check(e->pixel);
61 e->setPixelColorInternal(x, y, e->pixel);
62 }
63 }
64}
float sqrtf(float value) FL_NO_EXCEPT
Definition math.h:461

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

+ Here is the call graph for this function: