1- var start = new Date ( ) . getTime ( ) ;
2-
3- function getRandomColor ( ) {
4-
5- var x = Math . floor ( Math . random ( ) * 256 ) ;
6- var y = Math . floor ( Math . random ( ) * 256 ) ;
7- var z = Math . floor ( Math . random ( ) * 256 ) ;
8-
9- var randomColorMaker = "rgb(" + x + "," + y + "," + z + ")" ;
10-
11- document . getElementById ( "shape" ) . style . backgroundColor = randomColorMaker ;
12- }
13-
14- function makeShapeAppear ( ) {
15-
16- var top = Math . random ( ) * 400 ;
17-
18- var left = Math . random ( ) * 1150 ;
19-
20- var width = ( Math . random ( ) * 400 ) + 100 ;
21-
22- if ( Math . random ( ) < 0.5 ) {
23-
24- document . getElementById ( "shape" ) . style . borderRadius = "50%" ;
25- } else {
26-
27- document . getElementById ( "shape" ) . style . borderRadius = "0" ;
28- }
29-
30- document . getElementById ( "shape" ) . style . top = top + "px" ;
31- document . getElementById ( "shape" ) . style . left = left + "px" ;
32- document . getElementById ( "shape" ) . style . width = width + "px" ;
33- document . getElementById ( "shape" ) . style . height = width + "px" ;
1+ var canvas = document . getElementById ( "canvas1" ) ;
2+ var ctx = canvas . getContext ( "2d" ) ;
3+ ctx .
4+
5+
6+
7+ function openNav ( ) {
8+ document . getElementById ( "mySidenav" ) . style . width = "250px" ;
9+ document . getElementById ( "main" ) . style . marginLeft = "250px" ;
3410
35- document . getElementById ( "shape" ) . style . backgroundColor = getRandomColor ( ) ;
36-
37- document . getElementById ( "shape" ) . style . display = "block" ;
38- start = new Date ( ) . getTime ( ) ;
3911 }
40-
41- function Timeout ( ) {
42-
43- setTimeout ( makeShapeAppear , Math . random ( ) * 2000 ) ;
12+
13+ function closeNav ( ) {
14+ document . getElementById ( "mySidenav" ) . style . width = "0" ;
15+ document . getElementById ( "main" ) . style . marginLeft = "0" ;
4416
4517 }
46- Timeout ( ) ;
18+
19+ $ ( '#me' ) . click ( function ( ) {
20+
21+ alert ( "Hey!, I am Vidit.. I love to write CODE, I always say : First, solve the problem. Then, write the code., To know more about me , go to my facebook profile... " ) ;
22+ } ) ;
23+
24+
25+
4726
4827
49- document . getElementById ( "shape" ) . onclick = function ( ) {
50-
51- document . getElementById ( "shape" ) . style . display = "none" ;
52-
53- var end = new Date ( ) . getTime ( ) ;
54-
55- var timeTaken = ( end - start ) / 1000 + " sec" ;
56-
57- document . getElementById ( "timeTaken" ) . innerHTML = timeTaken ;
58-
59- var bestTime = 0 ;
60-
61- if ( timeTaken < bestTime ) {
62-
63- bestTime = timeTaken ;
64- document . getElementById ( "best" ) . innerHTML = bestTime + " sec" ;
65- } else {
66-
67- document . getElementById ( "best" ) . innerHTML = timeTaken + " sec" ;
68- }
69-
70-
71- Timeout ( ) ;
72- }
0 commit comments