yxw 2023-11-09 09:36:23 +08:00
parent 13c94c82ae
commit c7eb00c76e
1 changed files with 58 additions and 41 deletions

View File

@ -843,8 +843,8 @@
Microphone1Slider() Microphone1Slider()
Microphone2Slider() Microphone2Slider()
OutputVolumeSlider() OutputVolumeSlider()
LineInputLeftRandomBar(10, 5) LineInputLeftRandomBar(0)
LineInputRightRandomBar(10,5) LineInputRightRandomBar(0)
}) })
$(document).ready(function () { $(document).ready(function () {
@ -1023,63 +1023,80 @@
//调用接口提交数据 //调用接口提交数据
} }
function LineInputLeftRandomBar(max, value) { function LineInputLeftRandomBar(number) {
const bars = $("#lineinput .equalizer-bar-left") const bars = $("#lineinput .equalizer-bar-left")
for (let i = 0; i < bars.length; i++) { let row = (number + 72) / 3;
let spans = bars[i].getElementsByTagName('span'); let red = (-6 + 72) / 3;
console.log(spans) let yellow = (-18 + 72) / 3;
for (let j = 0; j < spans.length; j++) { let spans = bars[0].getElementsByTagName('span');
if (j >= 10 && j < 12) { for (let i = 0; i < spans.length; i++) {
spans[j].style.opacity = "1" if (row > i) {
spans[j].style.backgroundColor = "#ff0000" if (row >= red && i >= red) {
spans[i].style.opacity = "1"
spans[i].style.backgroundColor = "#ff0000"
} }
else if (j < 10 && j >= 7) { else if (row >= yellow && i < red && i >= yellow) {
spans[j].style.opacity = "1" spans[i].style.opacity = "1"
spans[j].style.backgroundColor = "#ff6600" spans[i].style.backgroundColor = "#ff6600"
} }
else if (j < 7) {
spans[j].style.opacity = "1"
spans[j].style.backgroundColor = "#a7dce9"
}
else { else {
spans[j].style.opacity = "1" spans[i].style.opacity = "1"
spans[j].style.backgroundColor = "#333" spans[i].style.backgroundColor = "#a7dce9"
} }
} }
else {
spans[i].style.opacity = "1"
spans[i].style.backgroundColor = "#333"
}
} }
} }
function LineInputRightRandomBar(max, value) { function LineInputRightRandomBar(number) {
const bars = $("#lineinput .equalizer-bar-right") const bars = $("#lineinput .equalizer-bar-right")
let num = 68; let row = (number + 72) / 3;
let row = 68/3; let red = (-6 + 72) / 3;
let yellow = (-18 + 72) / 3;
for (let i = 0; i < bars.length; i++) { let spans = bars[0].getElementsByTagName('span');
let spans = bars[i].getElementsByTagName('span'); for (let i = 0; i < spans.length; i++) {
console.log(spans) if (row > i) {
if (row >= red && i >= red) {
for (let j = 0; j < spans.length; j++) { spans[i].style.opacity = "1"
if (j >= 15 && j < 18 && row > j) { spans[i].style.backgroundColor = "#ff0000"
spans[j].style.opacity = "1"
spans[j].style.backgroundColor = "#ff0000"
} }
else if (j < 15 && j >= 10) { else if (row >= yellow && i < red && i >= yellow) {
spans[j].style.opacity = "1" spans[i].style.opacity = "1"
spans[j].style.backgroundColor = "#ff6600" spans[i].style.backgroundColor = "#ff6600"
} }
else if (j < 10) {
spans[j].style.opacity = "1"
spans[j].style.backgroundColor = "#a7dce9"
}
else { else {
spans[j].style.opacity = "1" spans[i].style.opacity = "1"
spans[j].style.backgroundColor = "#333" spans[i].style.backgroundColor = "#a7dce9"
} }
} }
else {
spans[i].style.opacity = "1"
spans[i].style.backgroundColor = "#333"
}
} }
}
setInterval(() => {
setRandomBars();
}, 200);
function setRandomBars() {
let num = getRandomIntInclusive(0, 72)
let num2 = getRandomIntInclusive(0, 72)
LineInputLeftRandomBar(num-72)
LineInputRightRandomBar(num2-72)
}
function getRandomIntInclusive(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min; //含最大值,含最小值
} }
</script> </script>