-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontrols2.js
More file actions
59 lines (47 loc) · 1.58 KB
/
controls2.js
File metadata and controls
59 lines (47 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//We only have to change background-color and height of the sorting element.
var speed=10;
inp_aspeed.addEventListener("input",vis_speed);
function vis_speed()
{
var array_speed=inp_aspeed.value;
switch(parseInt(array_speed))
{
case 1: speed=5;
break;
case 2: speed=40;
break;
case 3: speed=80;
break;
case 4: speed=300;
break;
case 5: speed=140;
break;
case 6:speed=1000;
break;
case 7:speed=10000;
break;
}
delay_time=10000/(Math.floor(array_size/10)*speed); //Decrease numerator to increase speed.
}
var delay_time=1000/(Math.floor(array_size/10)*speed); //Decrease numerator to increase speed.
var c_delay=0;//This is updated ov every div change so that visualization is visible.
function div_update(cont,color)
{
window.setTimeout(function(){
cont.style=" margin:0.5% " + margin_size + "%; height:20%; color:white; width:" + (100/array_size-(2*margin_size)) + "%; %; background-color:" + color + ";";
},c_delay+=delay_time);
}
function enable_buttons()
{
window.setTimeout(function(){
for(var i=0;i<butts_algos.length;i++)
{
butts_algos[i].classList=[];
butts_algos[i].classList.add("butt_unselected");
butts_algos[i].disabled=false;
inp_as.disabled=false;
inp_gen.disabled=false;
inp_aspeed.disabled=false;
}
},c_delay+=delay_time);
}