MCPcopy Create free account
hub / github.com/FastLED/FastLED / emitOrbitalDots

Method emitOrbitalDots

src/fl/fx/2d/flowfield.cpp.hpp:257–275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

255}
256
257void FlowFieldFloat::emitOrbitalDots(float t) {
258 int w = (int)getWidth();
259 int h = (int)getHeight();
260 int minDim = fl::min(w, h);
261 int n = mParams.dot_count;
262 float fn = (float)n;
263 float ocx = w * 0.5f - 0.5f;
264 float ocy = h * 0.5f - 0.5f;
265 float orad = minDim * 0.35f;
266 float base = t * 3.0f;
267 float dotDiam = 1.5f;
268 for (int i = 0; i < n; i++) {
269 float a = base + i * (2.0f * FL_PI / fn);
270 float cx = ocx + cosf(a) * orad;
271 float cy = ocy + sinf(a) * orad;
272 CRGB c = rainbow(t, mParams.color_shift, (float)i / fn);
273 drawDot(cx, cy, dotDiam, c.r, c.g, c.b);
274 }
275}
276
277void FlowFieldFloat::flowPrepare(float t) {
278 int w = (int)getWidth();

Callers

nothing calls this directly

Calls 4

cosfFunction · 0.85
sinfFunction · 0.85
s16x16Class · 0.50
sincosFunction · 0.50

Tested by

no test coverage detected