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

◆ draw()

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

Implements fl::IAnimartrix2Viz.

Definition at line 75 of file module_experiment7.cpp.hpp.

75 {
76 auto *e = ctx.mEngine.get();
77 e->get_ready();
78 mState.ensureCache(e);
79 const fl::i32 *fade_lut = fl::assume_aligned<16>(mState.fade_lut);
80 const fl::u8 *perm = PERLIN_NOISE;
81
82 e->timings.master_speed = 0.005;
83
84 float w = 0.3;
85
86 e->timings.ratio[0] = 0.01;
87 e->timings.ratio[1] = 0.011;
88 e->timings.ratio[2] = 0.029;
89 e->timings.ratio[3] = 0.33 * w;
90 e->timings.ratio[4] = 0.36 * w;
91
92 e->calculate_oscillators(e->timings);
93
94 for (int x = 0; x < e->num_x; x++) {
95 for (int y = 0; y < e->num_y; y++) {
96
97 float s = 0.7;
98
99 e->animation.dist =
100 2 + e->distance[x][y] +
101 2 * fl::sinf(0.25 * e->distance[x][y] - e->move.radial[3]);
102 e->animation.angle = e->polar_theta[x][y];
103 e->animation.z = 5;
104 e->animation.scale_x = 0.1 * s;
105 e->animation.scale_y = 0.1 * s;
106 e->animation.offset_z = 10 * e->move.linear[0];
107 e->animation.offset_y = -20 * e->move.linear[0];
108 e->animation.offset_x = 10;
109 e->animation.low_limit = 0;
110 e->show1 = render_value_fp_from_float(e->animation, fade_lut, perm);
111
112 e->animation.dist =
113 2 + e->distance[x][y] +
114 2 * fl::sinf(0.24 * e->distance[x][y] - e->move.radial[4]);
115 e->animation.angle = e->polar_theta[x][y];
116 e->animation.z = 10;
117 e->animation.scale_x = 0.1 * s;
118 e->animation.scale_y = 0.1 * s;
119 e->animation.offset_z = 0.1 * e->move.linear[1];
120 e->animation.offset_y = -20 * e->move.linear[1];
121 e->animation.offset_x = 10;
122 e->animation.low_limit = 0;
123 e->show2 = render_value_fp_from_float(e->animation, fade_lut, perm);
124
125 e->pixel.red = (e->show1 + e->show2);
126 e->pixel.green = ((e->show1 + e->show2) * 0.6) - 50;
127 e->pixel.blue = 0;
128
129 e->pixel = e->rgb_sanity_check(e->pixel);
130
131 e->setPixelColorInternal(x, y, e->pixel);
132 }
133 }
134}
T * assume_aligned(T *ptr) FL_NO_EXCEPT
Definition s16x16x4.h:126
unsigned char u8
Definition stdint.h:131
FASTLED_FORCE_INLINE fl::i32 render_value_fp_from_float(const render_parameters &anim, const fl::i32 *fade_lut, const fl::u8 *perm) FL_NO_EXCEPT
float sinf(float value) FL_NO_EXCEPT
Definition math.h:360

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

+ Here is the call graph for this function: