Skip to content

Commit 7c8496b

Browse files
committed
08 in progress
1 parent 9479e8d commit 7c8496b

File tree

1 file changed

+30
-9
lines changed

1 file changed

+30
-9
lines changed
Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,40 @@
11
<!DOCTYPE html>
22
<html lang="en">
3+
34
<head>
45
<meta charset="UTF-8">
56
<title>HTML5 Canvas</title>
67
</head>
8+
79
<body>
8-
<canvas id="draw" width="800" height="800"></canvas>
9-
<script>
10-
</script>
10+
<canvas id="draw" width="800" height="800"></canvas>
11+
<script>
12+
const canvas = document.querySelector('#draw');
13+
const ctx = canvas.getContext('2d');
14+
15+
canvas.width = window.innerWidth;
16+
canvas.height = window.innerHeight;
17+
ctx.strokeStyle = '#BADA55';
18+
ctx.lineCap = 'round';
19+
20+
let isDrawing = false;
21+
let lastX = 0;
22+
let lastY = 0;
1123

12-
<style>
13-
html, body {
14-
margin:0;
15-
}
16-
</style>
24+
function draw(e) {
25+
console.log('e', e);
26+
}
27+
28+
canvas.addEventListener('mousemove', draw);
29+
</script>
30+
31+
<style>
32+
html,
33+
body {
34+
margin: 0;
35+
}
36+
</style>
1737

1838
</body>
19-
</html>
39+
40+
</html>

0 commit comments

Comments
 (0)