19FASTLED_SMART_PTR(Pride2015);
26 fl::Str fxName()
const override {
return "Pride2015"; }
29 uint16_t mPseudotime = 0;
30 uint16_t mLastMillis = 0;
37 if (ctx.leds ==
nullptr || mNumLeds == 0) {
42 uint8_t brightdepth =
beatsin88(341, 96, 224);
43 uint16_t brightnessthetainc16 =
beatsin88(203, (25 * 256), (40 * 256));
44 uint8_t msmultiplier =
beatsin88(147, 23, 60);
46 uint16_t hue16 = mHue16;
47 uint16_t hueinc16 =
beatsin88(113, 1, 3000);
49 uint16_t ms = millis();
50 uint16_t deltams = ms - mLastMillis;
52 mPseudotime += deltams * msmultiplier;
54 uint16_t brightnesstheta16 = mPseudotime;
57 for (uint16_t i = 0; i < mNumLeds; i++) {
59 uint8_t hue8 = hue16 / 256;
61 brightnesstheta16 += brightnessthetainc16;
62 uint16_t b16 =
sin16(brightnesstheta16) + 32768;
64 uint16_t bri16 = (uint32_t)((uint32_t)b16 * (uint32_t)b16) / 65536;
65 uint8_t bri8 = (uint32_t)(((uint32_t)bri16) * brightdepth) / 65536;
66 bri8 += (255 - brightdepth);
68 CRGB newcolor =
CHSV(hue8, sat8, bri8);
70 uint16_t pixelnumber = (mNumLeds - 1) - i;
72 nblend(ctx.leds[pixelnumber], newcolor, 64);
central include file for FastLED, defines the CFastLED class/object
void draw(Fx::DrawContext context) override
LIB8STATIC uint16_t beatsin88(accum88 beats_per_minute_88, uint16_t lowest=0, uint16_t highest=65535, uint32_t timebase=0, uint16_t phase_offset=0)
Generates a 16-bit sine wave at a given BPM that oscillates within a given range.
CRGB & nblend(CRGB &existing, const CRGB &overlay, fract8 amountOfOverlay)
Destructively modifies one color, blending in a given fraction of an overlay color.
#define sin16
Platform-independent alias of the fast sin implementation.
Implements the FastLED namespace macros.
Implements a simple red square effect for 2D LED grids.
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
Representation of an RGB pixel (Red, Green, Blue)