Skip to content

Commit 47ee63f

Browse files
committed
Eighteen new effects 🔥
Migrated from StarLight, different origins, WLED etc
1 parent 93a8c9b commit 47ee63f

File tree

8 files changed

+13908
-2265
lines changed

8 files changed

+13908
-2265
lines changed

docs/moonlight/overview.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ Effects, Modifiers, Layouts and drivers use emoji's to visualize their usage. Se
128128
* 🎨 Using palette
129129
* 🐙 WLED origin
130130
* 💫 MoonLight origin
131+
* ⚡: FastLED origin
131132
* 🚨 Moving head color effect
132133
* 🗼 Moving head move effect
133134
* 💎 Modifier

interface/src/lib/components/moonbase/FieldRenderer.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@
234234
{:else if property.type == 'coord3D'}
235235
<input
236236
type="number"
237-
style="width: {String(property.max || 255).length * 2}ch"
237+
style="width: {String(property.max || 255).length + 5}ch"
238238
class="input invalid:border-error invalid:border-2"
239239
min="0"
240240
max="65536"
@@ -243,7 +243,7 @@
243243
/>
244244
<input
245245
type="number"
246-
style="width: {String(property.max || 255).length * 2}ch"
246+
style="width: {String(property.max || 255).length + 5}ch"
247247
class="input invalid:border-error invalid:border-2"
248248
min="0"
249249
max="65536"
@@ -252,7 +252,7 @@
252252
/>
253253
<input
254254
type="number"
255-
style="width: {String(property.max || 255).length * 2}ch"
255+
style="width: {String(property.max || 255).length + 5}ch"
256256
class="input invalid:border-error invalid:border-2"
257257
min="0"
258258
max="65536"

lib/framework/WWWData.h

Lines changed: 12768 additions & 1128 deletions
Large diffs are not rendered by default.

src/MoonLight/Modules/ModuleEffects.h

Lines changed: 64 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ class ModuleEffects : public NodeManager {
6060
EXT_LOGV(ML_TAG, "");
6161
JsonObject control; // state.data has one or more properties
6262
control = addControl(controls, "layer", "select");
63-
control["default"] = 1;
64-
uint8_t i = 1; //start with 1
63+
control["default"] = 0; // the first entry has index 0 and refers to Layer 1 (layer counting starts with 1)
64+
uint8_t i = 1; // start with 1
6565
for (VirtualLayer* layer : layerP.layers) {
6666
addControlValue(control, i);
6767
i++;
@@ -78,24 +78,30 @@ class ModuleEffects : public NodeManager {
7878

7979
// MoonLight effects, Solid first then alphabetically
8080
addControlValue(control, getNameAndTags<SolidEffect>());
81+
addControlValue(control, getNameAndTags<AudioRingsEffect>());
8182
addControlValue(control, getNameAndTags<LinesEffect>());
83+
addControlValue(control, getNameAndTags<FireEffect>());
8284
addControlValue(control, getNameAndTags<FixedRectangleEffect>());
8385
addControlValue(control, getNameAndTags<ParticlesEffect>());
8486
addControlValue(control, getNameAndTags<PraxisEffect>());
8587
#if USE_M5UNIFIED
8688
addControlValue(control, getNameAndTags<MoonManEffect>());
8789
#endif
8890
addControlValue(control, getNameAndTags<FreqSawsEffect>());
91+
addControlValue(control, getNameAndTags<MarioTestEffect>());
92+
addControlValue(control, getNameAndTags<PixelMapEffect>());
8993
addControlValue(control, getNameAndTags<RainbowEffect>());
9094
addControlValue(control, getNameAndTags<RandomEffect>());
95+
addControlValue(control, getNameAndTags<RingRandomFlowEffect>());
9196
addControlValue(control, getNameAndTags<RipplesEffect>());
9297
addControlValue(control, getNameAndTags<RubiksCubeEffect>());
9398
addControlValue(control, getNameAndTags<ScrollingTextEffect>());
9499
addControlValue(control, getNameAndTags<SinusEffect>());
95100
addControlValue(control, getNameAndTags<SphereMoveEffect>());
101+
addControlValue(control, getNameAndTags<SpiralFireEffect>());
96102
addControlValue(control, getNameAndTags<StarFieldEffect>());
103+
addControlValue(control, getNameAndTags<VUMeterEffect>());
97104
addControlValue(control, getNameAndTags<WaveEffect>());
98-
addControlValue(control, getNameAndTags<SpiralFireEffect>());
99105

100106
// MoonModules effects, alphabetically
101107
addControlValue(control, getNameAndTags<GameOfLifeEffect>());
@@ -107,14 +113,27 @@ class ModuleEffects : public NodeManager {
107113
addControlValue(control, getNameAndTags<BouncingBallsEffect>());
108114
addControlValue(control, getNameAndTags<BlurzEffect>());
109115
addControlValue(control, getNameAndTags<DistortionWavesEffect>());
116+
addControlValue(control, getNameAndTags<DJLightEffect>());
117+
addControlValue(control, getNameAndTags<DNAEffect>());
118+
addControlValue(control, getNameAndTags<DripEffect>());
110119
addControlValue(control, getNameAndTags<FreqMatrixEffect>());
120+
addControlValue(control, getNameAndTags<FireworksEffect>());
121+
addControlValue(control, getNameAndTags<FlowEffect>());
122+
addControlValue(control, getNameAndTags<FrizzlesEffect>());
123+
addControlValue(control, getNameAndTags<FunkyPlankEffect>());
111124
addControlValue(control, getNameAndTags<GEQEffect>());
125+
addControlValue(control, getNameAndTags<HeartBeatEffect>());
112126
addControlValue(control, getNameAndTags<LissajousEffect>());
113127
addControlValue(control, getNameAndTags<Noise2DEffect>());
114128
addControlValue(control, getNameAndTags<NoiseMeterEffect>());
129+
addControlValue(control, getNameAndTags<OctopusEffect>());
115130
addControlValue(control, getNameAndTags<PopCornEffect>());
131+
addControlValue(control, getNameAndTags<RainEffect>());
116132
addControlValue(control, getNameAndTags<WaverlyEffect>());
117133

134+
// FastLED effects
135+
addControlValue(control, getNameAndTags<RainbowWithGlitterEffect>());
136+
118137
// Moving head effects, alphabetically
119138
addControlValue(control, getNameAndTags<AmbientMoveEffect>());
120139
addControlValue(control, getNameAndTags<FreqColorsEffect>());
@@ -151,20 +170,32 @@ class ModuleEffects : public NodeManager {
151170
// MoonLight effects, Solid first then alphabetically
152171
if (equalAZaz09(name, SolidEffect::name()))
153172
node = allocMBObject<SolidEffect>();
173+
else if (equalAZaz09(name, AudioRingsEffect::name()))
174+
node = allocMBObject<AudioRingsEffect>();
175+
else if (equalAZaz09(name, FireEffect::name()))
176+
node = allocMBObject<FireEffect>();
154177
else if (equalAZaz09(name, FixedRectangleEffect::name()))
155178
node = allocMBObject<FixedRectangleEffect>();
156179
else if (equalAZaz09(name, FreqSawsEffect::name()))
157180
node = allocMBObject<FreqSawsEffect>();
158181
else if (equalAZaz09(name, LinesEffect::name()))
159182
node = allocMBObject<LinesEffect>();
183+
else if (equalAZaz09(name, MarioTestEffect::name()))
184+
node = allocMBObject<MarioTestEffect>();
160185
#if USE_M5UNIFIED
161186
else if (equalAZaz09(name, MoonManEffect::name()))
162187
node = allocMBObject<MoonManEffect>();
163188
#endif
189+
else if (equalAZaz09(name, ParticlesEffect::name()))
190+
node = allocMBObject<ParticlesEffect>();
164191
else if (equalAZaz09(name, PraxisEffect::name()))
165192
node = allocMBObject<PraxisEffect>();
193+
else if (equalAZaz09(name, PixelMapEffect::name()))
194+
node = allocMBObject<PixelMapEffect>();
166195
else if (equalAZaz09(name, RandomEffect::name()))
167196
node = allocMBObject<RandomEffect>();
197+
else if (equalAZaz09(name, RingRandomFlowEffect::name()))
198+
node = allocMBObject<RingRandomFlowEffect>();
168199
else if (equalAZaz09(name, RipplesEffect::name()))
169200
node = allocMBObject<RipplesEffect>();
170201
else if (equalAZaz09(name, RubiksCubeEffect::name()))
@@ -181,6 +212,8 @@ class ModuleEffects : public NodeManager {
181212
node = allocMBObject<WaveEffect>();
182213
else if (equalAZaz09(name, SpiralFireEffect::name()))
183214
node = allocMBObject<SpiralFireEffect>();
215+
else if (equalAZaz09(name, VUMeterEffect::name()))
216+
node = allocMBObject<VUMeterEffect>();
184217

185218
// MoonModules effects, alphabetically
186219
else if (equalAZaz09(name, GameOfLifeEffect::name()))
@@ -199,25 +232,47 @@ class ModuleEffects : public NodeManager {
199232
node = allocMBObject<BlurzEffect>();
200233
else if (equalAZaz09(name, DistortionWavesEffect::name()))
201234
node = allocMBObject<DistortionWavesEffect>();
235+
else if (equalAZaz09(name, DJLightEffect::name()))
236+
node = allocMBObject<DJLightEffect>();
237+
else if (equalAZaz09(name, DNAEffect::name()))
238+
node = allocMBObject<DNAEffect>();
239+
else if (equalAZaz09(name, DripEffect::name()))
240+
node = allocMBObject<DripEffect>();
241+
else if (equalAZaz09(name, FireworksEffect::name()))
242+
node = allocMBObject<FireworksEffect>();
243+
else if (equalAZaz09(name, FlowEffect::name()))
244+
node = allocMBObject<FlowEffect>();
202245
else if (equalAZaz09(name, FreqMatrixEffect::name()))
203246
node = allocMBObject<FreqMatrixEffect>();
247+
else if (equalAZaz09(name, FrizzlesEffect::name()))
248+
node = allocMBObject<FrizzlesEffect>();
249+
else if (equalAZaz09(name, FunkyPlankEffect::name()))
250+
node = allocMBObject<FunkyPlankEffect>();
204251
else if (equalAZaz09(name, GEQEffect::name()))
205252
node = allocMBObject<GEQEffect>();
253+
else if (equalAZaz09(name, HeartBeatEffect::name()))
254+
node = allocMBObject<HeartBeatEffect>();
206255
else if (equalAZaz09(name, LissajousEffect::name()))
207256
node = allocMBObject<LissajousEffect>();
208257
else if (equalAZaz09(name, Noise2DEffect::name()))
209258
node = allocMBObject<Noise2DEffect>();
210259
else if (equalAZaz09(name, NoiseMeterEffect::name()))
211260
node = allocMBObject<NoiseMeterEffect>();
212-
else if (equalAZaz09(name, ParticlesEffect::name()))
213-
node = allocMBObject<ParticlesEffect>();
261+
else if (equalAZaz09(name, OctopusEffect::name()))
262+
node = allocMBObject<OctopusEffect>();
214263
else if (equalAZaz09(name, PopCornEffect::name()))
215264
node = allocMBObject<PopCornEffect>();
216-
else if (equalAZaz09(name, RainbowEffect::name()))
217-
node = allocMBObject<RainbowEffect>();
265+
else if (equalAZaz09(name, RainEffect::name()))
266+
node = allocMBObject<RainEffect>();
218267
else if (equalAZaz09(name, WaverlyEffect::name()))
219268
node = allocMBObject<WaverlyEffect>();
220269

270+
// FastLED
271+
else if (equalAZaz09(name, RainbowEffect::name()))
272+
node = allocMBObject<RainbowEffect>();
273+
else if (equalAZaz09(name, RainbowWithGlitterEffect::name()))
274+
node = allocMBObject<RainbowWithGlitterEffect>();
275+
221276
// Moving head effects, alphabetically
222277

223278
else if (equalAZaz09(name, AmbientMoveEffect::name()))
@@ -268,8 +323,8 @@ class ModuleEffects : public NodeManager {
268323
node->constructor(layerP.layers[0], controls); // pass the layer to the node
269324
// node->moduleControl = _moduleLightsControl; // to access global lights control functions if needed
270325
// node->moduleIO = _moduleIO; // to get pin allocations
271-
node->moduleNodes = (Module*)this; // to request UI update
272-
node->setup(); // run the setup of the effect
326+
node->moduleNodes = (Module*)this; // to request UI update
327+
node->setup(); // run the setup of the effect
273328
node->onSizeChanged(Coord3D());
274329
// layers[0]->nodes.reserve(index+1);
275330
if (index >= layerP.layers[0]->nodes.size())

src/MoonLight/Nodes/Effects/E_FastLED.h

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,56 @@
1111

1212
#if FT_MOONLIGHT
1313

14+
class RainbowEffect : public Node {
15+
public:
16+
static const char* name() { return "Rainbow"; }
17+
static uint8_t dim() { return _1D; }
18+
static const char* tags() { return "🔥⚡"; }
19+
20+
uint8_t deltaHue = 7;
21+
uint8_t speed = 8; // default 8*32 = 256 / 256 = 1 = hue++
22+
23+
void setup() {
24+
addControl(speed, "speed", "slider", 0, 32);
25+
addControl(deltaHue, "deltaHue", "slider", 0, 32);
26+
}
27+
28+
uint16_t hue = 0;
29+
30+
void loop() override {
31+
layer->fill_rainbow((hue += speed * 32) >> 8, deltaHue); // hue back to uint8_t
32+
}
33+
};
34+
35+
class RainbowWithGlitterEffect : public Node {
36+
public:
37+
static const char* name() { return "Rainbow with glitter"; }
38+
static uint8_t dim() { return _1D; }
39+
static const char* tags() { return "🔥⚡"; } // ⚡ means FastLED origin
40+
41+
bool glitter = false;
42+
uint8_t chance = 80;
43+
44+
void setup() override {
45+
// no palette control is created
46+
addControl(glitter, "glitter", "checkbox");
47+
addControl(chance, "glitter", "checkbox");
48+
}
49+
50+
void loop() override {
51+
// built-in FastLED rainbow, plus some random sparkly glitter
52+
// FastLED's built-in rainbow generator
53+
layer->fill_rainbow(millis() / 50, 7);
54+
55+
if (glitter) addGlitter(chance);
56+
}
57+
58+
void addGlitter(fract8 chanceOfGlitter) {
59+
if (random8() < chanceOfGlitter) {
60+
layer->setRGB(random16(layer->size.x), CRGB::White);
61+
}
62+
}
63+
};
64+
65+
1466
#endif

0 commit comments

Comments
 (0)