FastLED 3.10.8
Loading...
Searching...
No Matches
spiral_matrix10.cpp.hpp
Go to the documentation of this file.
5#include "fl/stl/noexcept.h"
6
9
10namespace fl {
11
13 auto *e = ctx.mEngine.get();
14 e->get_ready();
15
16 e->timings.master_speed = 0.006;
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.0053;
21 e->timings.ratio[4] = 0.0056;
22 e->timings.ratio[5] = 0.0059;
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
29 float scale = 0.6;
30
31 e->animation.dist = e->distance[x][y];
32 e->animation.angle = e->polar_theta[x][y];
33 e->animation.z = 5;
34 e->animation.scale_x = 0.09 * scale;
35 e->animation.scale_y = 0.09 * scale;
36 e->animation.offset_y = -30 * e->move.linear[0];
37 e->animation.offset_z = 0;
38 e->animation.offset_x = 0;
39 e->animation.low_limit = -1;
40 e->show1 = e->render_value(e->animation);
41
42 e->animation.dist = e->distance[x][y];
43 e->animation.angle = e->polar_theta[x][y];
44 e->animation.z = 50;
45 e->animation.scale_x = 0.09 * scale;
46 e->animation.scale_y = 0.09 * scale;
47 e->animation.offset_y = -30 * e->move.linear[1];
48 e->animation.offset_z = 0;
49 e->animation.offset_x = 0;
50 e->animation.low_limit = -1;
51 e->show2 = e->render_value(e->animation);
52
53 e->animation.dist = e->distance[x][y];
54 e->animation.angle = e->polar_theta[x][y] + 2 + (e->show1 / 255) * PI;
55 e->animation.z = 5;
56 e->animation.scale_x = 0.09 * scale;
57 e->animation.scale_y = 0.09 * scale;
58 e->animation.offset_y = -10 * e->move.linear[0];
59 e->animation.offset_z = 0;
60 e->animation.offset_x = 0;
61 e->animation.low_limit = 0;
62 e->show3 = e->render_value(e->animation);
63
64 e->animation.dist = e->distance[x][y];
65 e->animation.angle = e->polar_theta[x][y] + 2 + (e->show2 / 255) * PI;
66 ;
67 e->animation.z = 5;
68 e->animation.scale_x = 0.09 * scale;
69 e->animation.scale_y = 0.09 * scale;
70 e->animation.offset_y = -20 * e->move.linear[0];
71 e->animation.offset_z = 0;
72 e->animation.offset_x = 0;
73 e->animation.low_limit = 0;
74 e->show4 = e->render_value(e->animation);
75
76 e->show5 = e->screen(e->show4, e->show3);
77 e->show6 = e->colordodge(e->show5, e->show3);
78
79 e->pixel.red = (e->show5 + e->show6) / 2;
80 e->pixel.green = (e->show5 - 50) + (e->show6 / 16);
81 e->pixel.blue = 0;
82
83 e->pixel = e->rgb_sanity_check(e->pixel);
84
85 e->setPixelColorInternal(x, y, e->pixel);
86 }
87 }
88}
89
90
91// ============================================================================
92// Fixed-Point Implementation of SpiralMatrix10
93// ============================================================================
94
96 auto *e = ctx.mEngine.get();
97 e->get_ready();
98 mState.ensureCache(e);
99 const fl::i32 *fade_lut = fl::assume_aligned<16>(mState.fade_lut);
100 const fl::u8 *perm = PERLIN_NOISE;
101
102 e->timings.master_speed = 0.006;
103 e->timings.ratio[0] = 0.025;
104 e->timings.ratio[1] = 0.027;
105 e->timings.ratio[2] = 0.031;
106 e->timings.ratio[3] = 0.0053;
107 e->timings.ratio[4] = 0.0056;
108 e->timings.ratio[5] = 0.0059;
109
110 e->calculate_oscillators(e->timings);
111
112 for (int x = 0; x < e->num_x; x++) {
113 for (int y = 0; y < e->num_y; y++) {
114
115 float scale = 0.6;
116
117 e->animation.dist = e->distance[x][y];
118 e->animation.angle = e->polar_theta[x][y];
119 e->animation.z = 5;
120 e->animation.scale_x = 0.09 * scale;
121 e->animation.scale_y = 0.09 * scale;
122 e->animation.offset_y = -30 * e->move.linear[0];
123 e->animation.offset_z = 0;
124 e->animation.offset_x = 0;
125 e->animation.low_limit = -1;
126 e->show1 = render_value_fp_from_float(e->animation, fade_lut, perm);
127
128 e->animation.dist = e->distance[x][y];
129 e->animation.angle = e->polar_theta[x][y];
130 e->animation.z = 50;
131 e->animation.scale_x = 0.09 * scale;
132 e->animation.scale_y = 0.09 * scale;
133 e->animation.offset_y = -30 * e->move.linear[1];
134 e->animation.offset_z = 0;
135 e->animation.offset_x = 0;
136 e->animation.low_limit = -1;
137 e->show2 = render_value_fp_from_float(e->animation, fade_lut, perm);
138
139 e->animation.dist = e->distance[x][y];
140 e->animation.angle = e->polar_theta[x][y] + 2 + (e->show1 / 255) * PI;
141 e->animation.z = 5;
142 e->animation.scale_x = 0.09 * scale;
143 e->animation.scale_y = 0.09 * scale;
144 e->animation.offset_y = -10 * e->move.linear[0];
145 e->animation.offset_z = 0;
146 e->animation.offset_x = 0;
147 e->animation.low_limit = 0;
148 e->show3 = render_value_fp_from_float(e->animation, fade_lut, perm);
149
150 e->animation.dist = e->distance[x][y];
151 e->animation.angle = e->polar_theta[x][y] + 2 + (e->show2 / 255) * PI;
152 ;
153 e->animation.z = 5;
154 e->animation.scale_x = 0.09 * scale;
155 e->animation.scale_y = 0.09 * scale;
156 e->animation.offset_y = -20 * e->move.linear[0];
157 e->animation.offset_z = 0;
158 e->animation.offset_x = 0;
159 e->animation.low_limit = 0;
160 e->show4 = render_value_fp_from_float(e->animation, fade_lut, perm);
161
162 e->show5 = e->screen(e->show4, e->show3);
163 e->show6 = e->colordodge(e->show5, e->show3);
164
165 e->pixel.red = (e->show5 + e->show6) / 2;
166 e->pixel.green = (e->show5 - 50) + (e->show6 / 16);
167 e->pixel.blue = 0;
168
169 e->pixel = e->rgb_sanity_check(e->pixel);
170
171 e->setPixelColorInternal(x, y, e->pixel);
172 }
173 }
174}
175
176} // namespace fl
177
fl::UISlider scale("Scale", 4,.1, 4,.1)
#define PI
void draw(Context &ctx) FL_NO_EXCEPT override
void draw(Context &ctx) FL_NO_EXCEPT override
#define FL_OPTIMIZATION_LEVEL_O3_BEGIN
#define FL_FAST_MATH_BEGIN
#define FL_FAST_MATH_END
#define FL_OPTIMIZATION_LEVEL_O3_END
T * assume_aligned(T *ptr) FL_NO_EXCEPT
Definition s16x16x4.h:126
unsigned char u8
Definition stdint.h:131
u8 u8 fract8 blur_amount FL_NO_EXCEPT
Definition blur.h:186
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
Base definition for an LED controller.
Definition crgb.hpp:179