Skip to content

Commit baeaf74

Browse files
committed
update
1 parent bb0717c commit baeaf74

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

Sorting_Project.html

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
var randomsize=[];
55
var X,Y,height,width,arraysize,canvas,ctx;
66
var i,min_idx,j;
7-
7+
var flag=true;
8+
var req;
89

910
function draw()
1011
{
@@ -44,31 +45,32 @@
4445
for (j = i+1; j < randomsize.length; j++)
4546
{
4647
beforecolor();
47-
//setTimeout(aftercolor,1000);
48+
//sleep(200);
4849
aftercolor();
49-
//setTimeout(nothing,1000);
50-
nothing();
5150
}
52-
//setTimeout(comingout,2000*(randomsize.length-i-1));
5351
comingout();
54-
}
55-
52+
}
5653
}
5754

55+
function sleep(miliseconds) {
56+
var currentTime = new Date().getTime();
57+
58+
while (currentTime + miliseconds >= new Date().getTime()) {
5859

60+
}
61+
}
62+
5963
function beforecolor()
6064
{
6165
X=(canvas.width-100)/arraysize*(j+1);
6266
Y=50;
6367
width=(canvas.width-100)/arraysize;
6468
ctx.fillStyle="green";
6569
ctx.fillRect(X+1,Y,width-1,randomsize[j]);
66-
67-
}
70+
}
6871

6972
function aftercolor()
7073
{
71-
7274
X=(canvas.width-100)/arraysize*(j+1);
7375
Y=50;
7476
width=(canvas.width-100)/arraysize;
@@ -78,10 +80,6 @@
7880
ctx.fillStyle="red";
7981

8082
ctx.fillRect(X+1,Y,width-1,randomsize[j]);
81-
}
82-
83-
function nothing()
84-
{
8583

8684
}
8785

0 commit comments

Comments
 (0)