FixedRectangleEffect
Source:
FixedRectangleEffect.h
FixedRectangleEffect¶
src/light/effects/FixedRectangleEffect.h:26Inherits:
EffectBase
Test effect: draws a fixed rectangle at set coordinates.
Author: limpkin (MoonLight), https://github.com/ewowi/MoonLight/blob/main/src/MoonLight/Nodes/Effects/E_MoonLight.h
A solid box at a dialed-in position and extent, over a slow motion-trail fade. So it serves as a static fixture, an alignment aid, or a painted region.
Prior art: MoonLight's FixedRectangle, whose clamping and checkerboard this reproduces.
Public Attributes¶
uint8_t red = 182
: The box's red channel.
uint8_t green = 15
: Its green channel.
uint8_t blue = 98
: Its blue channel.
uint8_t white = 0
: Its white channel, used only on an RGBW grid.
int16_t rectX = 0
: The box's origin on x.
int16_t rectY = 0
: Its origin on y.
int16_t rectZ = 0
: Its origin on z.
int16_t rectW = 15
: Its extent along x, clamped to the grid so a small panel fills to the edge.
int16_t rectH = 15
: Its extent along y.
int16_t rectD = 15
: Its extent along z.
bool alternateWhite = false
: Render the box as a checkerboard of white and its color.
Public Methods¶
virtual inline const char * tags() const override
: Catalog tags: MoonLight origin.
virtual inline Dim dimensions() const override
: The box has an extent on all three axes.
virtual inline void defineControls() override
: Publish the box's color, its origin and extent, and the checkerboard.
virtual inline void tick() override
: Paint the box, clamped to the grid, over the trail fade.
More info¶
The checkerboard follows the box's longer side¶
With alternateWhite the box renders as white and colored tiles. The toggle flips every cell when the box is wider than tall, and once a row when taller. So the pattern runs along whichever side is longer.
On an RGBW grid a white tile carries the white value and a colored tile clears it. That keeps a colored cell off the white LED, and leaves no stale value from a prior frame.