Last active
August 29, 2015 14:24
-
-
Save chrishamant/06a86b15d6fb69bb1071 to your computer and use it in GitHub Desktop.
Revisions
-
chrishamant revised this gist
Jul 1, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,5 +22,5 @@ </script> <body onload="init()"> <img style="float:left" id="gamePiece" src="https://s-media-cache-ak0.pinimg.com/736x/fd/4d/74/fd4d74d5083647d78a68ce087b2e350c.jpg"> -
chrishamant renamed this gist
Jul 1, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
chrishamant created this gist
Jul 1, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ <script> function init(){ var gameLength = 15000 // 15 seconds var s = 0 // Number of clicks var t = Date.now() //start time (in seconds since 1970) var elm = document.getElementById("gamePiece") elm.onclick = function(){ s++ var elapsed = Date.now() - t if(elapsed < gameLength){ elm.style.margin = elapsed % 300 + ' 0 0 ' + elapsed * 7 % 300 }else{ alert(s) //number of clicks at end of game } } } </script> <body onload="init()"> <p style="float:left" id="gamePiece"> X