make responsive canvas -> audioVisualizer
parent
b51aff371b
commit
c5e68af502
|
|
@ -66,7 +66,6 @@ const IndexInterface = () => {
|
||||||
analyser.fftSize = 256;
|
analyser.fftSize = 256;
|
||||||
|
|
||||||
let bufferLength = analyser.frequencyBinCount;
|
let bufferLength = analyser.frequencyBinCount;
|
||||||
console.log(bufferLength);
|
|
||||||
|
|
||||||
let dataArray = new Uint8Array(bufferLength);
|
let dataArray = new Uint8Array(bufferLength);
|
||||||
|
|
||||||
|
|
@ -77,7 +76,7 @@ const IndexInterface = () => {
|
||||||
let barHeight;
|
let barHeight;
|
||||||
let x = 0;
|
let x = 0;
|
||||||
|
|
||||||
let frameString = '==================================================='
|
let frameString = '===================================================='
|
||||||
|
|
||||||
let frameStrings = [] // 52 chars in row
|
let frameStrings = [] // 52 chars in row
|
||||||
|
|
||||||
|
|
@ -118,7 +117,8 @@ const IndexInterface = () => {
|
||||||
frame = frameString.slice(0, barHeight / 10) + '='
|
frame = frameString.slice(0, barHeight / 10) + '='
|
||||||
ctx.fillText(frame, 0, x);
|
ctx.fillText(frame, 0, x);
|
||||||
|
|
||||||
x += barWidth - 27;
|
|
||||||
|
x += window.innerHeight / (bufferLength - 34);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const timerAudio = () => {
|
const timerAudio = () => {
|
||||||
|
|
@ -153,13 +153,12 @@ const IndexInterface = () => {
|
||||||
document.getElementById('audioProgressBar').innerHTML = bar.replace('|', '#')
|
document.getElementById('audioProgressBar').innerHTML = bar.replace('|', '#')
|
||||||
lastProgressValue = progress
|
lastProgressValue = progress
|
||||||
}
|
}
|
||||||
console.log(progress)
|
|
||||||
console.log(lastProgressValue)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
audio.play();
|
audio.play();
|
||||||
renderFrame();
|
renderFrame();
|
||||||
|
console.log('height ' + window.innerHeight + ', width ' + window.innerWidth)
|
||||||
await progressBarAudio()
|
await progressBarAudio()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
#audioVisualizerDiv {
|
#audioVisualizerDiv {
|
||||||
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 20%;
|
|
||||||
display: flex;
|
|
||||||
|
|
||||||
#audioMenu {
|
#audioMenu {
|
||||||
height: 500px;
|
height: 500px;
|
||||||
|
|
@ -11,6 +10,7 @@
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
position: fixed;
|
position: fixed;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
z-index: 1;
|
||||||
|
|
||||||
div {
|
div {
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
|
|
@ -20,6 +20,8 @@
|
||||||
#canvas {
|
#canvas {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#audio {
|
#audio {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue