Skip to content

Commit 99cb5ab

Browse files
author
Em01
committedMar 24, 2015
basic functionality of canvas
1 parent 2319d99 commit 99cb5ab

File tree

3 files changed

+28
-15
lines changed

3 files changed

+28
-15
lines changed
 

‎canvasanimated/canvasanimation.hmtl

-14
This file was deleted.

‎canvasanimated/canvasanimation.html

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Canvas Animation</title>
5+
</head>
6+
7+
<body>
8+
<canvas id="canvas" width="200" height="200"></canvas>
9+
10+
<script>
11+
var canvas = document.getElementById("canvas");
12+
var ctx = canvas.getContext("2d");
13+
14+
var position = 0;
15+
16+
setInterval(function () {
17+
ctx.clearRect(0, 0, 200, 200);
18+
ctx.fillRect(position, 0, 20, 20);
19+
20+
position++;
21+
if (position > 200) {
22+
position = 0;
23+
}
24+
}, 30);
25+
</script>
26+
</body>
27+
</html>

‎treasuregamejs/treasure.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<body>
88
<h1 id="heading">Find the buried treasure!</h1>
99

10-
<img id="map" width=400 height=400
10+
<img id="map" width=1500 height=1000
1111
src="http://nostarch.com/images/treasuremap.png">
1212

1313
<p id="distance"></p>

0 commit comments

Comments
 (0)