Skip to content

PaintBrushEffect

Source: PaintBrushEffect.h

PaintBrushEffect

class PaintBrushEffect
src/light/effects/PaintBrushEffect.h:26

Inherits: EffectBase

Effect that paints moving brush-stroke lines across the layer.

PaintBrushEffect card PaintBrushEffect controls Author: @TroyHacks (WLED MoonModules, GPLv3), https://github.com/ewowi/MoonLight/blob/main/src/MoonLight/Nodes/Effects/E_MoonModules.h

Lines whose endpoints oscillate in 3D on the beat, each shortened by a band's magnitude. That shortening is what makes the strokes curve and sweep. The field fades each frame, so the lines leave brush strokes rather than redrawing cleanly.

Prior art: MoonLight's PaintBrush, whose six endpoints and length feedback this reproduces.

Public Attributes

uint8_t oscillatorOffset = 6 * 160 / 255 : The phase-spread multiplier between the six endpoint oscillators.

uint8_t numLines = 255 : How many lines are animated in parallel.

uint8_t fadeRate = 40 : How fast the background decays, which is the brush-stroke trail.

uint8_t minLength = 0 : A line draws only when it runs longer than this.

bool color_chaos = false : Vary the hue per line rather than running a gradient across the bands.

bool phase_chaos = false : Jitter every endpoint's phase once a frame.

Public Methods

virtual inline const char * tags() const override : Catalog tags: MoonLight origin, MoonModules, audio-reactive.

virtual inline Dim dimensions() const override : Volumetric: the endpoints oscillate on all three axes.

virtual inline void defineControls() override : Publish the oscillators, the line count, the trail and the two chaos switches.

virtual inline void tick() override : Fade the field, then draw each line between its two oscillating endpoints.

More info

What a line does

Each line takes one band, and its Euclidean span scaled by that band becomes the shorten amount. A line draws only when it runs longer than minLength, so quiet bands stay dark. Silence leaves no lines at all, and the field fades to black.

The soft anti-alias control is omitted, since [draw::line] is crisp and has no Xiaolin-Wu form.