Skip to content

Commit 446f933

Browse files
committed
Breakout practice initial commit
1 parent c47a932 commit 446f933

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

practice/breakout/game.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const canvas = document.getElementById('canvas');
2+
const ctx = canvas.getContext('2d');
3+
4+
ctx.fillStyle = 'blue';
5+
6+
function animate() {
7+
ctx.clearRect(0,0,480,320);
8+
9+
ctx.fillRect(10, 10, 100, 100);
10+
11+
requestAnimationFrame(animate);
12+
}
13+
14+
animate();

practice/breakout/index.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Breakout!</title>
6+
<link rel="stylesheet" href="style.css" type="text/css">
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8+
<style>
9+
* {
10+
padding: 0;
11+
margin: 0;
12+
}
13+
canvas {
14+
background: #eeeeee;
15+
display: block;
16+
margin: 10px auto;
17+
}
18+
</style>
19+
</head>
20+
<body>
21+
<canvas id="canvas" width="480" height="320" style="border:1px solid black;"></canvas>
22+
<script src="game.js"></script>
23+
</body>
24+
</html>

0 commit comments

Comments
 (0)