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

◆ draw()

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

Implements fl::IAnimartrix2Viz.

Definition at line 65 of file slow_fade.cpp.hpp.

65 {
66 auto *e = ctx.mEngine.get();
67 e->get_ready();
68 mState.ensureCache(e);
69 const fl::i32 *fade_lut = fl::assume_aligned<16>(mState.fade_lut);
70 const fl::u8 *perm = PERLIN_NOISE;
71
72 e->run_default_oscillators();
73 e->timings.master_speed = 0.00005;
74 e->calculate_oscillators(e->timings);
75
76 for (int x = 0; x < e->num_x; x++) {
77 for (int y = 0; y < e->num_y; y++) {
78 e->animation.dist =
79 fl::sqrtf(e->distance[x][y]) * 0.7 * (e->move.directional[0] + 1.5);
80 e->animation.angle =
81 e->polar_theta[x][y] - e->move.radial[0] + e->distance[x][y] / 5;
82
83 e->animation.scale_x = 0.11;
84 e->animation.scale_y = 0.11;
85
86 e->animation.offset_y = -50 * e->move.linear[0];
87 e->animation.offset_x = 0;
88 e->animation.offset_z = 0;
89
90 e->animation.z = e->move.linear[0];
91 e->animation.low_limit = -0.1;
92 e->animation.high_limit = 1;
93 float show1 = render_value_fp_from_float(e->animation, fade_lut, perm);
94
95 e->animation.dist = e->animation.dist * 1.1;
96 e->animation.angle += e->move.noise_angle[0] / 10;
97 float show2 = render_value_fp_from_float(e->animation, fade_lut, perm);
98
99 e->animation.dist = e->animation.dist * 1.1;
100 e->animation.angle += e->move.noise_angle[1] / 10;
101 float show3 = render_value_fp_from_float(e->animation, fade_lut, perm);
102
103 float radius = e->radial_filter_radius;
104 float radial = (radius - e->distance[x][y]) / e->distance[x][y];
105
106 e->pixel.red = radial * show1;
107 e->pixel.green = radial * (show1 - show2) / 6;
108 e->pixel.blue = radial * (show1 - show3) / 5;
109
110 e->pixel = e->rgb_sanity_check(e->pixel);
111 e->setPixelColorInternal(x, y, e->pixel);
112 }
113 }
114}
FPVizState mState
Definition slow_fade.h:23
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 sqrtf(float value) FL_NO_EXCEPT
Definition math.h:461

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

+ Here is the call graph for this function: