-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVisualizer.js
More file actions
22 lines (17 loc) · 771 Bytes
/
Visualizer.js
File metadata and controls
22 lines (17 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const intervalArray=[1000,200,100,50,1]
const arrayBar=document.getElementById("arrayBar");
var randomArrayBar=[]
const randomInterval =(keyBar, speedOfVisualization)=> new Promise((res)=>{
keyBar.style.backgroundColor="red"
setTimeout(res, intervalArray[speedOfVisualization-1])})
const randomInterval2 =(greaterNode, speedOfVisualization)=> new Promise((res)=>{
greaterNode.style.backgroundColor="blue"
setTimeout(res, intervalArray[speedOfVisualization])})
const blankAwait=(speedOfVisualization)=> new Promise((res)=>{
setTimeout(res,intervalArray[speedOfVisualization])
})
function renderAllBars(ArrayBar) {
for (let index = 0; index < ArrayBar.length; index++) {
arrayBar.appendChild(ArrayBar[index])
}
}