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()
Microphone2Slider()
OutputVolumeSlider()
LineInputLeftRandomBar(10, 5)
LineInputRightRandomBar(10,5)
LineInputLeftRandomBar(0)
LineInputRightRandomBar(0)
})
$(document).ready(function () {
@ -1023,64 +1023,81 @@
//调用接口提交数据
}
function LineInputLeftRandomBar(max, value) {
function LineInputLeftRandomBar(number) {
const bars = $("#lineinput .equalizer-bar-left")
for (let i = 0; i < bars.length; i++) {
let spans = bars[i].getElementsByTagName('span');
console.log(spans)
let row = (number + 72) / 3;
let red = (-6 + 72) / 3;
let yellow = (-18 + 72) / 3;
for (let j = 0; j < spans.length; j++) {
if (j >= 10 && j < 12) {
spans[j].style.opacity = "1"
spans[j].style.backgroundColor = "#ff0000"
let spans = bars[0].getElementsByTagName('span');
for (let i = 0; i < spans.length; i++) {
if (row > i) {
if (row >= red && i >= red) {
spans[i].style.opacity = "1"
spans[i].style.backgroundColor = "#ff0000"
}
else if (j < 10 && j >= 7) {
spans[j].style.opacity = "1"
spans[j].style.backgroundColor = "#ff6600"
else if (row >= yellow && i < red && i >= yellow) {
spans[i].style.opacity = "1"
spans[i].style.backgroundColor = "#ff6600"
}
else if (j < 7) {
spans[j].style.opacity = "1"
spans[j].style.backgroundColor = "#a7dce9"
}
else {
spans[j].style.opacity = "1"
spans[j].style.backgroundColor = "#333"
spans[i].style.opacity = "1"
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")
let num = 68;
let row = 68/3;
let row = (number + 72) / 3;
let red = (-6 + 72) / 3;
let yellow = (-18 + 72) / 3;
for (let i = 0; i < bars.length; i++) {
let spans = bars[i].getElementsByTagName('span');
console.log(spans)
for (let j = 0; j < spans.length; j++) {
if (j >= 15 && j < 18 && row > j) {
spans[j].style.opacity = "1"
spans[j].style.backgroundColor = "#ff0000"
let spans = bars[0].getElementsByTagName('span');
for (let i = 0; i < spans.length; i++) {
if (row > i) {
if (row >= red && i >= red) {
spans[i].style.opacity = "1"
spans[i].style.backgroundColor = "#ff0000"
}
else if (j < 15 && j >= 10) {
spans[j].style.opacity = "1"
spans[j].style.backgroundColor = "#ff6600"
else if (row >= yellow && i < red && i >= yellow) {
spans[i].style.opacity = "1"
spans[i].style.backgroundColor = "#ff6600"
}
else if (j < 10) {
spans[j].style.opacity = "1"
spans[j].style.backgroundColor = "#a7dce9"
}
else {
spans[j].style.opacity = "1"
spans[j].style.backgroundColor = "#333"
spans[i].style.opacity = "1"
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>
</html>