-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
49 lines (45 loc) · 1.23 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<title>2048 | By ruzhila.cn</title>
</head>
<body>
<style>
#game {
margin: 0 auto;
display: block;
background: #faf8ef;
border: 1px solid #bfbfbf;
}
.gameover {
text-align: center;
font-size: 40px;
color: #776e65;
display: none;
}
.restart {
font-size: 20px;
color: blueviolet;
}
</style>
<div>
<div style="height: 90px;">
<h2 style="text-align: center; color: cornflowerblue">2048 game with 100 lines of Javascript | By
ruzhila.cn</h2>
<div class="gameover">
<span>Game over</span>
<span class="restart" onclick="restart()">restart</span>
</div>
</div>
<canvas id="game" width="480" height="480"></canvas>
</div>
<script src="2048.js"></script>
<script>
let game = new Game(document.getElementById('game').getContext('2d'));
game.start();
function restart() {
document.getElementsByClassName('gameover')[0].style.display = 'none';
game.start();
}
</script>
</body>