FastLED 3.10.10
Loading...
Searching...
No Matches

◆ sceneKnot()

static void sceneKnot ( unsigned long t)
static
Examples
Polygon.ino.

Definition at line 186 of file Polygon.ino.

186 {
187 const fl::i32 ph1 = angleAt(t, 11000);
188 const fl::i32 ph2 = angleAt(t, 8700);
189 const fl::i32 rx = mulQ16(kCX, 60293L); // 0.92 of the half-width
190 const fl::i32 ry = mulQ16(kCY, 60293L);
191 for (int pass = 0; pass < 2; ++pass) { // second knot: x phase + pi
192 FixPt knot[kKnotN];
193 for (int i = 0; i < kKnotN; ++i) {
194 const fl::i32 th = (fl::i32)((fl::i64)i * kTwoPi / kKnotN);
195 const fl::i32 sx = Fix::sin(wrap(2 * th + ph1 + pass * kPi)).raw();
196 const fl::i32 sy = Fix::sin(wrap(3 * th + ph2)).raw();
197 knot[i].x = Fix::from_raw(kCX + mulQ16(rx, sx));
198 knot[i].y = Fix::from_raw(kCY + mulQ16(ry, sy));
199 }
202 CHSV((fl::u8)(160 + 90 * pass), 190, 255), knot,
204 }
205}
static fl::i32 angleAt(unsigned long t, unsigned long periodMs)
Definition Polygon.ino:96
static const fl::i32 kCY
Definition Polygon.ino:88
fl::PolyPoint< Fix > FixPt
Definition Polygon.ino:80
static const fl::i32 kTwoPi
Definition Polygon.ino:85
static const int kKnotN
Definition Polygon.ino:184
static fl::i32 mulQ16(fl::i32 a, fl::i32 b)
Definition Polygon.ino:91
static const fl::i32 kCX
Definition Polygon.ino:87
fl::CanvasRGB canvas(fl::span< CRGB >(leds, NUM_LEDS), WIDTH, HEIGHT)
fl::s16x16 Fix
Definition Polygon.ino:79
static const fl::i32 kPi
Definition Polygon.ino:86
static Fix wrap(fl::i32 a)
Definition Polygon.ino:101
#define FL_GFX_POLYGON_DEFAULT_CHUNK
Definition canvas.h:70
constexpr i32 raw() const FL_NO_EXCEPT
Definition s16x16.h:62
FASTLED_FORCE_INLINE s16x16 sin() const FL_NO_EXCEPT
Definition s16x16.h:315
static constexpr FASTLED_FORCE_INLINE s16x16 from_raw(i32 raw) FL_NO_EXCEPT
Definition s16x16.h:56
static uint32_t t
Definition Luminova.h:55
fl::hsv8 CHSV
Definition chsv.h:11
unsigned char u8
Definition stdint.h:132
fl::i64 i64
Definition s16x16x4.h:222
@ DRAW_MODE_BLEND
Definition draw_mode.h:5

References fl::gfx::ABuffer, angleAt(), canvas, fl::DRAW_MODE_BLEND, FL_GFX_POLYGON_DEFAULT_CHUNK, fl::s16x16::from_raw(), kCX, kCY, kKnotN, kPi, kTwoPi, mulQ16(), fl::s16x16::raw(), fl::s16x16::sin(), t, wrap(), fl::gfx::PolyPoint< Coord >::x, and fl::gfx::PolyPoint< Coord >::y.

+ Here is the call graph for this function: