DistortionWavesEffect
Source:
DistortionWavesEffect.h
DistortionWavesEffect¶
src/light/effects/DistortionWavesEffect.h:24Inherits:
EffectBase
Interference effect: overlaid moving waves distorting the field.
Author: ldirko & blazoncek (WLED port), https://editor.soulmatelights.com/gallery/1089-distorsion-waves , via the predecessor, https://github.com/ewowi/MoonLight/blob/main/src/MoonLight/Nodes/Effects/E_WLED.h
Two sine waves whose summed value drives the hue, giving a flowing moire field. They run at independent frequencies and slightly different time rates, so they beat.
Prior art: WLED's Distortion Waves, by way of MoonLight.
Public Attributes¶
uint8_t freq_x = 3
: The horizontal wave's frequency.
uint8_t freq_y = 3
: The vertical wave's frequency.
uint8_t speed = 50
: How fast the field moves, where 0 freezes it.
Public Methods¶
virtual inline const char * tags() const override
: Catalog tags: MoonLight and WLED origin.
virtual inline Dim dimensions() const override
: A plane, which extrude lifts through a volume.
virtual inline void defineControls() override
: Publish both wave frequencies and the speed.
virtual inline void tick() override
: Sum the two waves per pixel and read the palette at their average.
More info¶
Integer throughout¶
Angles are bytes and the sines return bytes, which the effect averages into a hue. The vertical wave's time runs about 1.3 times the horizontal, approximated in integers. That hue then indexes the active palette, where the source swept hue directly.