forked from Twinkrun/twinkrun.github.com
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplay.html
More file actions
56 lines (49 loc) · 1.1 KB
/
play.html
File metadata and controls
56 lines (49 loc) · 1.1 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
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>play Twinkrun</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
</head>
<body>
<div >
<canvas id="display" style="background: #262629;" onClick="changeColor();"></canvas>
</div>
<script type="text/javascript">
var bStart = false;
//画面サイズの取得
//ウィンドウサイズの取得
//getWindowSize();
//画面サイズを取得する
function setCanvasSize() {
var w = window.innerWidth;
var h = window.innerHeight;
$("#display").attr("width", w*1.5);
$("#display").attr("height", h*1.5);
}
setCanvasSize();
if(bStart){
changeColor();
}
function changeColor(){
var rnd = parseInt(Math.random()*3);
console.log("rnd: ", rnd);
if (rnd == 0) {
$("#display").css("background", "#00D4C7");
}
else if (rnd == 1) {
$("#display").css("background", "#F0392C");
}
else if (rnd == 2) {
$("#display").css("background", "#262629");
}
setTimeout("changeColor()", 3000);
}
$("body").onclick = function(){
r
console.log("pressed");
bStart = !bStart;
}
</script>
</body>
</html>