-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpt4.html
More file actions
54 lines (46 loc) · 1.19 KB
/
pt4.html
File metadata and controls
54 lines (46 loc) · 1.19 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
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html>
<html>
<head>
<style>
*{
padding: 0;
margin: 0;
}
body{
background-color: azure;
}
canvas{
background-color: pink;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
}
</style>
</head>
<body>
<canvas width="400" height="400"></canvas>
</body>
<script type="text/javascript">
window.onload=function(){
var canvas = document.querySelector("canvas");
//取得筆
if(canvas.getContext){
var ctx = canvas.getContext("2d");
ctx.save();
ctx.beginPath();
ctx.fillStyle="black";
ctx.fillRect(0,0,200,200);
ctx.restore();
ctx.save();
ctx.beginPath();
ctx.fillStyle="yellow";
ctx.arc(100,100,50,0,360*Math.PI/180);
ctx.fill();
ctx.restore();
}
}
</script>
</html>