FastLED 3.9.15
Loading...
Searching...
No Matches
fluffy_blobs.cpp.hpp
Go to the documentation of this file.
5
8
9namespace fl {
10
12 auto *e = ctx.mEngine.get();
13
14 e->timings.master_speed = 0.015;
15 float size = 0.15;
16 float radial_speed = 1;
17 float linear_speed = 5;
18
19 e->timings.ratio[0] = 0.025;
20 e->timings.ratio[1] = 0.026;
21 e->timings.ratio[2] = 0.027;
22 e->timings.ratio[3] = 0.028;
23 e->timings.ratio[4] = 0.029;
24 e->timings.ratio[5] = 0.030;
25 e->timings.ratio[6] = 0.031;
26 e->timings.ratio[7] = 0.032;
27 e->timings.ratio[8] = 0.033;
28
29 e->calculate_oscillators(e->timings);
30
31 for (int x = 0; x < e->num_x; x++) {
32 for (int y = 0; y < e->num_y; y++) {
33
34 e->animation.dist = e->distance[x][y];
35 e->animation.angle = e->polar_theta[x][y] + (radial_speed * e->move.radial[0]);
36 e->animation.z = 5;
37 e->animation.scale_x = size;
38 e->animation.scale_y = size;
39 e->animation.offset_z = 0;
40 e->animation.offset_x = 0;
41 e->animation.offset_y = linear_speed * e->move.linear[0];
42 e->animation.low_limit = 0;
43 e->animation.high_limit = 1;
44 e->show1 = e->render_value(e->animation);
45
46 e->animation.angle = e->polar_theta[x][y] + (radial_speed * e->move.radial[1]);
47 e->animation.offset_y = linear_speed * e->move.linear[1];
48 e->animation.offset_z = 200;
49 e->animation.scale_x = size * 1.1;
50 e->animation.scale_y = size * 1.1;
51 e->show2 = e->render_value(e->animation);
52
53 e->animation.angle = e->polar_theta[x][y] + (radial_speed * e->move.radial[2]);
54 e->animation.offset_y = linear_speed * e->move.linear[2];
55 e->animation.offset_z = 400;
56 e->animation.scale_x = size * 1.2;
57 e->animation.scale_y = size * 1.2;
58 e->show3 = e->render_value(e->animation);
59
60 e->animation.angle = e->polar_theta[x][y] + (radial_speed * e->move.radial[3]);
61 e->animation.offset_y = linear_speed * e->move.linear[3];
62 e->animation.offset_z = 600;
63 e->animation.scale_x = size;
64 e->animation.scale_y = size;
65 e->show4 = e->render_value(e->animation);
66
67 e->animation.angle = e->polar_theta[x][y] + (radial_speed * e->move.radial[4]);
68 e->animation.offset_y = linear_speed * e->move.linear[4];
69 e->animation.offset_z = 800;
70 e->animation.scale_x = size * 1.1;
71 e->animation.scale_y = size * 1.1;
72 e->show5 = e->render_value(e->animation);
73
74 e->animation.angle = e->polar_theta[x][y] + (radial_speed * e->move.radial[5]);
75 e->animation.offset_y = linear_speed * e->move.linear[5];
76 e->animation.offset_z = 1800;
77 e->animation.scale_x = size * 1.2;
78 e->animation.scale_y = size * 1.2;
79 e->show6 = e->render_value(e->animation);
80
81 e->animation.angle = e->polar_theta[x][y] + (radial_speed * e->move.radial[6]);
82 e->animation.offset_y = linear_speed * e->move.linear[6];
83 e->animation.offset_z = 2800;
84 e->animation.scale_x = size;
85 e->animation.scale_y = size;
86 e->show7 = e->render_value(e->animation);
87
88 e->animation.angle = e->polar_theta[x][y] + (radial_speed * e->move.radial[7]);
89 e->animation.offset_y = linear_speed * e->move.linear[7];
90 e->animation.offset_z = 3800;
91 e->animation.scale_x = size * 1.1;
92 e->animation.scale_y = size * 1.1;
93 e->show8 = e->render_value(e->animation);
94
95 e->animation.angle = e->polar_theta[x][y] + (radial_speed * e->move.radial[8]);
96 e->animation.offset_y = linear_speed * e->move.linear[8];
97 e->animation.offset_z = 4800;
98 e->animation.scale_x = size * 1.2;
99 e->animation.scale_y = size * 1.2;
100 e->show9 = e->render_value(e->animation);
101
102 e->pixel.red = 0.8 * (e->show1 + e->show2 + e->show3) + (e->show4 + e->show5 + e->show6);
103 e->pixel.green = 0.8 * (e->show4 + e->show5 + e->show6);
104 e->pixel.blue = 0.3 * (e->show7 + e->show8 + e->show9);
105
106 e->pixel = e->rgb_sanity_check(e->pixel);
107
108 e->setPixelColorInternal(x, y, e->pixel);
109 }
110 }
111}
112
113
114// ============================================================================
115// Fixed-Point Implementation of Fluffy_Blobs
116// ============================================================================
117
119 auto *e = ctx.mEngine.get();
120 mState.ensureCache(e);
121 const fl::i32 *fade_lut = fl::assume_aligned<16>(mState.fade_lut);
122 const fl::u8 *perm = PERLIN_NOISE;
123
124 e->timings.master_speed = 0.015;
125 float size = 0.15;
126 float radial_speed = 1;
127 float linear_speed = 5;
128
129 e->timings.ratio[0] = 0.025;
130 e->timings.ratio[1] = 0.026;
131 e->timings.ratio[2] = 0.027;
132 e->timings.ratio[3] = 0.028;
133 e->timings.ratio[4] = 0.029;
134 e->timings.ratio[5] = 0.030;
135 e->timings.ratio[6] = 0.031;
136 e->timings.ratio[7] = 0.032;
137 e->timings.ratio[8] = 0.033;
138
139 e->calculate_oscillators(e->timings);
140
141 for (int x = 0; x < e->num_x; x++) {
142 for (int y = 0; y < e->num_y; y++) {
143
144 e->animation.dist = e->distance[x][y];
145 e->animation.angle = e->polar_theta[x][y] + (radial_speed * e->move.radial[0]);
146 e->animation.z = 5;
147 e->animation.scale_x = size;
148 e->animation.scale_y = size;
149 e->animation.offset_z = 0;
150 e->animation.offset_x = 0;
151 e->animation.offset_y = linear_speed * e->move.linear[0];
152 e->animation.low_limit = 0;
153 e->animation.high_limit = 1;
154 e->show1 = render_value_fp_from_float(e->animation, fade_lut, perm);
155
156 e->animation.angle = e->polar_theta[x][y] + (radial_speed * e->move.radial[1]);
157 e->animation.offset_y = linear_speed * e->move.linear[1];
158 e->animation.offset_z = 200;
159 e->animation.scale_x = size * 1.1;
160 e->animation.scale_y = size * 1.1;
161 e->show2 = render_value_fp_from_float(e->animation, fade_lut, perm);
162
163 e->animation.angle = e->polar_theta[x][y] + (radial_speed * e->move.radial[2]);
164 e->animation.offset_y = linear_speed * e->move.linear[2];
165 e->animation.offset_z = 400;
166 e->animation.scale_x = size * 1.2;
167 e->animation.scale_y = size * 1.2;
168 e->show3 = render_value_fp_from_float(e->animation, fade_lut, perm);
169
170 e->animation.angle = e->polar_theta[x][y] + (radial_speed * e->move.radial[3]);
171 e->animation.offset_y = linear_speed * e->move.linear[3];
172 e->animation.offset_z = 600;
173 e->animation.scale_x = size;
174 e->animation.scale_y = size;
175 e->show4 = render_value_fp_from_float(e->animation, fade_lut, perm);
176
177 e->animation.angle = e->polar_theta[x][y] + (radial_speed * e->move.radial[4]);
178 e->animation.offset_y = linear_speed * e->move.linear[4];
179 e->animation.offset_z = 800;
180 e->animation.scale_x = size * 1.1;
181 e->animation.scale_y = size * 1.1;
182 e->show5 = render_value_fp_from_float(e->animation, fade_lut, perm);
183
184 e->animation.angle = e->polar_theta[x][y] + (radial_speed * e->move.radial[5]);
185 e->animation.offset_y = linear_speed * e->move.linear[5];
186 e->animation.offset_z = 1800;
187 e->animation.scale_x = size * 1.2;
188 e->animation.scale_y = size * 1.2;
189 e->show6 = render_value_fp_from_float(e->animation, fade_lut, perm);
190
191 e->animation.angle = e->polar_theta[x][y] + (radial_speed * e->move.radial[6]);
192 e->animation.offset_y = linear_speed * e->move.linear[6];
193 e->animation.offset_z = 2800;
194 e->animation.scale_x = size;
195 e->animation.scale_y = size;
196 e->show7 = render_value_fp_from_float(e->animation, fade_lut, perm);
197
198 e->animation.angle = e->polar_theta[x][y] + (radial_speed * e->move.radial[7]);
199 e->animation.offset_y = linear_speed * e->move.linear[7];
200 e->animation.offset_z = 3800;
201 e->animation.scale_x = size * 1.1;
202 e->animation.scale_y = size * 1.1;
203 e->show8 = render_value_fp_from_float(e->animation, fade_lut, perm);
204
205 e->animation.angle = e->polar_theta[x][y] + (radial_speed * e->move.radial[8]);
206 e->animation.offset_y = linear_speed * e->move.linear[8];
207 e->animation.offset_z = 4800;
208 e->animation.scale_x = size * 1.2;
209 e->animation.scale_y = size * 1.2;
210 e->show9 = render_value_fp_from_float(e->animation, fade_lut, perm);
211
212 e->pixel.red = 0.8 * (e->show1 + e->show2 + e->show3) + (e->show4 + e->show5 + e->show6);
213 e->pixel.green = 0.8 * (e->show4 + e->show5 + e->show6);
214 e->pixel.blue = 0.3 * (e->show7 + e->show8 + e->show9);
215
216 e->pixel = e->rgb_sanity_check(e->pixel);
217
218 e->setPixelColorInternal(x, y, e->pixel);
219 }
220 }
221}
222
223} // namespace fl
224
void draw(Context &ctx) override
void draw(Context &ctx) override
unsigned char u8
Definition s16x16x4.h:132
T * assume_aligned(T *ptr) FL_NOEXCEPT
Definition s16x16x4.h:126
FASTLED_FORCE_INLINE fl::i32 render_value_fp_from_float(const render_parameters &anim, const fl::i32 *fade_lut, const fl::u8 *perm)
Base definition for an LED controller.
Definition crgb.hpp:179
#define FL_OPTIMIZATION_LEVEL_O3_BEGIN
#define FL_FAST_MATH_BEGIN
#define FL_FAST_MATH_END
#define FL_OPTIMIZATION_LEVEL_O3_END
fl::unique_ptr< Engine > mEngine
Definition context.h:38