-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy path026.磁盘图.html
44 lines (37 loc) · 1.14 KB
/
026.磁盘图.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
35
36
37
38
39
40
41
42
43
44
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./assets/global.css">
<style>
.disk-container {
position: relative;
width: 1400px;
height: 1400px;
}
</style>
</head>
<body>
<canvas id="disk" class="disk-container"></canvas>
<script>
var c = document.getElementById("disk");
/** @type {CanvasRenderingContext2D} */
var ctx = c.getContext("2d");
c.width = c.clientWidth
c.height = c.clientHeight
var center = c.clientWidth / 2
for (let i = 0; i < 30; i++) {
ctx.beginPath()
ctx.lineWidth = 5
ctx.strokeStyle = 'rgb(66,155,66)'
// 重叠细节需要根据圈值改变对应下边儿第二个参数
ctx.setLineDash([3, 3]);
ctx.arc(center, center, center - 100 - 8 * i, 0, Math.PI * 2)
ctx.closePath();
ctx.stroke()
}
</script>
</body>
</html>