-
Notifications
You must be signed in to change notification settings - Fork 93
Expand file tree
/
Copy pathvisualizations.js
More file actions
65 lines (53 loc) · 1.62 KB
/
visualizations.js
File metadata and controls
65 lines (53 loc) · 1.62 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
60
61
62
63
64
65
/*
*****************
DONE BY:- TUMMALA KETHAN
*****************
*/
//We only have to change background-color and height of the sorting element.
var speed=1000;
inp_aspeed.addEventListener("input",vis_speed);
function vis_speed()
{
var array_speed=inp_aspeed.value;
switch(parseInt(array_speed))
{
case 1: speed=1;
break;
case 2: speed=10;
break;
case 3: speed=100;
break;
case 4: speed=1000;
break;
case 5: speed=10000;
break;
}
delay_time=10000/(Math.floor(array_size/10)*speed); //Decrease numerator to increase speed.
}
var delay_time=10000/(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,height,color)
{
window.setTimeout(function(){
cont.style=" margin:0% " + margin_size + "%; width:" + (100/array_size-(2*margin_size)) + "%; height:" + height + "%; 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);
}
/*
*****************
DONE BY:- TUMMALA KETHAN
*****************
*/