68#define NUM_LEDS (WIDTH * HEIGHT)
71#define PIN_DATA FL_PIN_CLOCKLESS_1
84static const fl::i32
kOne = 65536L;
85static const fl::i32
kTwoPi = 411775L;
86static const fl::i32
kPi = 205887L;
91static fl::i32
mulQ16(fl::i32 a, fl::i32 b) {
92 return (fl::i32)(((
fl::i64)a * b) >> 16);
96static fl::i32
angleAt(
unsigned long t,
unsigned long periodMs) {
108static FixPt polar(fl::i32 cx, fl::i32 cy, fl::i32 r, fl::i32 a) {
121 const fl::i32 spin =
angleAt(
t, 7000);
122 const fl::i32 len =
mulQ16(
kR, 62259L);
123 const fl::i32 back =
mulQ16(len, 36045L);
125 for (
int k = 0; k < 6; ++k) {
126 const fl::i32 a = spin + k * (
kTwoPi / 6);
127 const FixPt blade[3] = {
144static void drawStar(
float cx,
float cy,
float r,
float spin,
const CRGB& color) {
146 for (
int i = 0; i < 5; ++i) {
147 const float a = spin + (float)i * (2.0f * 6.2831853f / 5.0f);
151 canvas.drawPolygon(color, star);
157 const float spin = (float)(
t % 9000) * (6.2831853f / 9000.0f);
159 drawStar(cx, cy, r * 0.28f, -2.0f * spin,
CRGB(0, 120, 255));
168 static const CRGB kColors[3] = {
CRGB(255, 0, 80),
CRGB(255, 200, 0),
CRGB(0, 160, 255)};
169 for (
int layer = 0; layer < 3; ++layer) {
170 const fl::i32 r =
kR - layer * (
kR / 4);
171 fl::i32 a =
angleAt(
t, 9000UL - 2000UL * layer);
172 if (layer & 1) a = -a;
174 for (
int j = 0; j < 4; ++j) square[j] =
polar(
kCX,
kCY, r, a + j * (
kTwoPi / 4));
187 const fl::i32 ph1 =
angleAt(
t, 11000);
188 const fl::i32 ph2 =
angleAt(
t, 8700);
191 for (
int pass = 0; pass < 2; ++pass) {
193 for (
int i = 0; i <
kKnotN; ++i) {
202 CHSV((
fl::u8)(160 + 90 * pass), 190, 255), knot,
220 const unsigned long t = millis();
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
static void sceneKnot(unsigned long t)
static const int kNumScenes
static const fl::i32 kOne
static fl::i32 angleAt(unsigned long t, unsigned long periodMs)
fl::PolyPoint< Fix > FixPt
static const fl::i32 kTwoPi
static FixPt polar(fl::i32 cx, fl::i32 cy, fl::i32 r, fl::i32 a)
static fl::i32 mulQ16(fl::i32 a, fl::i32 b)
fl::CanvasRGB canvas(fl::span< CRGB >(leds, NUM_LEDS), WIDTH, HEIGHT)
void(* SceneFn)(unsigned long t)
static void scenePinwheel(unsigned long t)
static void sceneLayers(unsigned long t)
static const SceneFn kScenes[]
static void drawStar(float cx, float cy, float r, float spin, const CRGB &color)
static void sceneStar(unsigned long t)
static const unsigned long kSceneMs
static Fix wrap(fl::i32 a)
#define FL_GFX_POLYGON_DEFAULT_CHUNK
Convenience alias for CRGB canvas — use fl::CanvasRGB for no-template syntax.
constexpr i32 raw() const FL_NO_EXCEPT
FASTLED_FORCE_INLINE s16x16 sin() const FL_NO_EXCEPT
static constexpr FASTLED_FORCE_INLINE s16x16 from_raw(i32 raw) FL_NO_EXCEPT
static FASTLED_FORCE_INLINE void sincos(s16x16 angle, s16x16 &out_sin, s16x16 &out_cos) FL_NO_EXCEPT
void fill_solid(CRGB *targetArray, int numToFill, const CRGB &color) FL_NO_EXCEPT
Fill a range of LEDs with a solid color.
2D antialiased graphics for LED matrices
float sinf(float value) FL_NO_EXCEPT
gfx::PolyPoint< Coord > PolyPoint
Polygon vertex (x, y coordinate pair) for drawPolygon.
float cosf(float value) FL_NO_EXCEPT
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>