-
Notifications
You must be signed in to change notification settings - Fork 0
/
canvasClip.html
34 lines (30 loc) · 1.05 KB
/
canvasClip.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>canvas的剪辑区域</title>
</head>
<body>
<canvas id="myCanvas" style="background:#333" width="1000" height="1000">
<p>你的浏览器不支持Canvas</p>
</canvas>
<script>
window.onload = function(){
// 按钮
var canvas = document.getElementById('myCanvas'),
ctx = canvas.getContext('2d');
ctx.beginPath();
ctx.arc(300,300,100,0,2*Math.PI);
ctx.fillStyle="#fff";
ctx.fill();
ctx.clip();
ctx.font="bold 24px Arial";
ctx.fillStyle="#058";
ctx.textAlign="center";
ctx.fillText("this is a test clip ,attention",300,300);
}
</script>
</body>
</html>