Skip to content

Commit 88ba4b7

Browse files
committed
added multiple drop feature
updated readme increased version
1 parent 43174ad commit 88ba4b7

File tree

3 files changed

+140
-111
lines changed

3 files changed

+140
-111
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ This is a highly customizable animated Matrix wallpaper for Wallpaper Engine (We
3939
- Rain Customization
4040
- Matrix Speed
4141
- Trail Length
42+
- Drop Count/Column (1-5)
4243
- Initial Fall Animation
4344
- None
4445
- Fall
@@ -133,7 +134,6 @@ This is a highly customizable animated Matrix wallpaper for Wallpaper Engine (We
133134
- Download this Repo as ZIP and extract it.
134135

135136
## TODO:
136-
- Multiple drops (customizable count)
137137
- Small Clock and Messsage
138138
- Random Character Mutations
139139
- Random Character Flip

index.js

Lines changed: 48 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
window.onload = function () {
22
//MARK: Update
3-
const version = "v4.3.0";
3+
const version = "v5.0.0";
44

55
checkForUpdates = async () => {
66
const url = 'https://api.github.com/repos/IPdotSetAF/NeoMatrix/tags';
@@ -20,6 +20,7 @@ window.onload = function () {
2020
fpsInterval: calculateFpsInterval(24),
2121
ui_rain_trailLength: 0.86,
2222
trailLength: calculateTrailLength(0.86),
23+
ui_rain_dropCount: 1,
2324
ui_rain_initialAnimation: "1",
2425
ui_characters_charset: "4",
2526
ui_characters_customCharset: "0123456789ABCDEF",
@@ -93,6 +94,7 @@ window.onload = function () {
9394
options.trailLength = calculateTrailLength(options.ui_rain_trailLength);
9495
updateMask();
9596
});
97+
rainFolder.add(options, "ui_rain_dropCount").min(1).max(5).step(1).name("Drop Count/Column").onChange(initialAnimation);
9698
rainFolder.add(options, "ui_rain_initialAnimation", optionsToDict(config.general.properties.ui_rain_initialanimation.options)).name("Initial Animation").onChange(initialAnimation);
9799

98100
const colorFolder = gui.addFolder("Color");
@@ -174,10 +176,12 @@ window.onload = function () {
174176
options.trailLength = calculateTrailLength(properties.ui_rain_traillength.value);
175177
updateMask();
176178
}
177-
if (properties.ui_rain_initialanimation) {
179+
if (properties.ui_rain_initialanimation)
178180
options.ui_rain_initialAnimation = properties.ui_rain_initialanimation.value;
181+
if (properties.ui_rain_dropcount)
182+
options.ui_rain_dropCount = properties.ui_rain_dropcount.value;
183+
if (properties.ui_rain_initialanimation || properties.ui_rain_dropcount)
179184
initialAnimation();
180-
}
181185

182186
if (properties.ui_color_colormode)
183187
options.ui_color_colorMode = properties.ui_color_colormode.value;
@@ -468,21 +472,31 @@ window.onload = function () {
468472

469473
switch (options.ui_rain_initialAnimation) {
470474
case "0": {
471-
for (var i = 0; i < columns; i++)
472-
drops[i] = [rows + 1, 0, 0, "", 0];
475+
for (var i = 0; i < columns; i++) {
476+
drops[i] = [];
477+
for (var j = 0; j < options.ui_rain_dropCount; j++)
478+
drops[i][j] = [rows + 1, 0, 0, "", 0];
479+
}
473480
break;
474481
}
475482
case "1": {
476-
for (var i = 0; i < columns; i++)
477-
drops[i] = [1, 0, 0, "", 0];
483+
for (var i = 0; i < columns; i++) {
484+
drops[i] = [];
485+
drops[i][0] = [1, 0, 0, "", 0];
486+
for (var j = 1; j < options.ui_rain_dropCount; j++)
487+
drops[i][j] = [rows + 1, 0, 0, "", 0];
488+
}
478489
break;
479490
}
480491
case "2": {
481-
for (var i = 0; i < columns; i++)
482-
drops[i] = [Math.floor(Math.random() * rows), 0, 0, "", 0];
492+
for (var i = 0; i < columns; i++) {
493+
drops[i] = [];
494+
for (var j = 0; j < options.ui_rain_dropCount; j++)
495+
drops[i][j] = [Math.floor(Math.random() * rows), 0, 0, "", 0];
496+
}
483497
break;
484498
}
485-
}
499+
}
486500
}
487501

488502
function startAnimating() {
@@ -508,9 +522,8 @@ window.onload = function () {
508522
isSilent = true;
509523

510524
for (var i = 0; i < drops.length; i++) {
511-
var character = calculateCharacter(drops[i]);
512525
var probability = 0.975;
513-
var lightness = 50;
526+
var audio_lightness = 50;
514527

515528
if (options.ui_audio_audioResponsive) {
516529
var frequency = Math.floor(i * column_frequency);
@@ -521,33 +534,38 @@ window.onload = function () {
521534

522535
if (!AudioTimeout || !options.ui_audio_silenceAnimation) {
523536
probability = 1 - clamp(0, 1, (Volume * Volume * Volume * options.ui_audio_audioSensetivity));
524-
lightness = Math.floor(clamp(40, 80, Volume * 100 * options.ui_audio_audioSensetivity));
537+
audio_lightness = Math.floor(clamp(40, 80, Volume * 100 * options.ui_audio_audioSensetivity));
525538
}
526539
}
527540

528-
if (drops[i][1] > 0)
529-
lightness = 100;
541+
for (var j = 0; j < options.ui_rain_dropCount; j++) {
542+
var character = calculateCharacter(drops[i][j]);
543+
var lightness = audio_lightness;
530544

531-
if (options.ui_color_highlightFirstCharacter) {
532-
neoMatrix.clearRect(i * options.ui_font_size, ((drops[i][0] - 2) * options.ui_font_size) + font_fraction, options.ui_font_size, options.ui_font_size);
545+
if (drops[i][j][1] > 0)
546+
lightness = 100;
533547

534-
var tmp = drops[i][0] - 1;
535-
neoMatrix.fillStyle = calculateColor(i, tmp, drops[i][4]);
536-
neoMatrix.fillText(drops[i][3], i * options.ui_font_size, tmp * options.ui_font_size);
548+
if (options.ui_color_highlightFirstCharacter) {
549+
neoMatrix.clearRect(i * options.ui_font_size, ((drops[i][j][0] - 2) * options.ui_font_size) + font_fraction, options.ui_font_size, options.ui_font_size);
537550

538-
neoMatrix.fillStyle = "#FFF";
539-
}
540-
else
541-
neoMatrix.fillStyle = calculateColor(i, drops[i][0], lightness);
551+
var tmp = drops[i][j][0] - 1;
552+
neoMatrix.fillStyle = calculateColor(i, tmp, drops[i][j][4]);
553+
neoMatrix.fillText(drops[i][j][3], i * options.ui_font_size, tmp * options.ui_font_size);
542554

543-
neoMatrix.clearRect(i * options.ui_font_size, ((drops[i][0] - 1) * options.ui_font_size) + font_fraction, options.ui_font_size, options.ui_font_size);
544-
drops[i][3] = character, drops[i][4] = lightness;
545-
neoMatrix.fillText(character, i * options.ui_font_size, drops[i][0] * options.ui_font_size);
555+
neoMatrix.fillStyle = "#FFF";
556+
}
557+
else
558+
neoMatrix.fillStyle = calculateColor(i, drops[i][j][0], lightness);
546559

547-
if (drops[i][0] > rows && Math.random() > probability)
548-
drops[i] = [0, 0, 0, "", 0];
560+
neoMatrix.clearRect(i * options.ui_font_size, ((drops[i][j][0] - 1) * options.ui_font_size) + font_fraction, options.ui_font_size, options.ui_font_size);
561+
drops[i][j][3] = character, drops[i][j][4] = lightness;
562+
neoMatrix.fillText(character, i * options.ui_font_size, drops[i][j][0] * options.ui_font_size);
549563

550-
drops[i][0]++;
564+
if (drops[i][j][0] > rows && Math.random() > probability)
565+
drops[i][j] = [0, 0, 0, "", 0];
566+
567+
drops[i][j][0]++;
568+
}
551569
}
552570

553571
if (options.ui_audio_silenceAnimation) {

0 commit comments

Comments
 (0)