-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfinish-index.html
More file actions
43 lines (40 loc) · 1.04 KB
/
Copy pathfinish-index.html
File metadata and controls
43 lines (40 loc) · 1.04 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Canvas Tutorial</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<h1>Canvas Tutorial</h1>
<div class="row">
<h3>Draw a Box</h3>
<canvas id="canvas"></canvas>
</div>
<div class="row">
<h3>Original Image</h3>
<img src="gorilla-model.jpg">
</div>
<div class="row">
<h3>Canvas Image</h3>
<canvas id="gorilla" height="286" width="400"></canvas>
</div>
<script type="text/javascript">
// Draw a colored box
let canvas = document.getElementById("canvas");
let ctx = canvas.getContext("2d");
ctx.fillStyle = "#FF0000";
ctx.fillRect(0,0,150,150);
// ctx.clearRect(10,10,130,130);
// Draw Image...
window.onload = function() {
let canvas = document.getElementById("gorilla");
let ctx = canvas.getContext("2d");
let img = new Image();
img.src = 'gorilla-model.jpg';
ctx.drawImage(img, 10, 10);
};
</script>
</body>
</html>