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