-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy path14-simple-pie-charts.html
91 lines (81 loc) · 1.84 KB
/
14-simple-pie-charts.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Simple pie charts</title>
<link rel="stylesheet" href="css/style.css" />
<style media="screen">
div, svg {
display: inline-block;
vertical-align: middle;
box-sizing: border-box;
}
.pie {
width: 100px;
height: 100px;
background: yellowgreen;
border-radius: 50%;
background-image: linear-gradient(to right, transparent 50%, #655 0);
}
.pie::before {
content: '';
display: block;
margin-left: 50%;
height: 100%;
border-radius: 0 100% 100% 0 / 50%;
background: yellowgreen;
transform-origin: left;
animation: spin 3s linear infinite, bg 6s step-end infinite;
animation-delay: inherit;
animation-play-state: paused;
}
.pie.animate::before {
border: 1px solid red;
animation-play-state: running;
}
@keyframes bg {
50% { background: #655 }
}
@keyframes spin {
0% { transform: rotate(0turn) }
100% { transform: rotate(.5turn) }
}
svg {
width: 100px;
height: 100px;
transform: rotate(-90deg);
background: yellowgreen;
border-radius: 50%;
}
@keyframes fillup {
0% { stroke-dasharray: 0 100 }
100% { stroke-dasharray: 100 100 }
}
circle {
fill: yellowgreen;
stroke: #655;
stroke-width: 32;
}
.svg-pie.animate circle {
animation: fillup 5s linear infinite;
}
.future-pie {
background: conic-gradient(#655 40%, yellowgreen 0);
}
</style>
</head>
<body>
<div class="pie animate"></div>
<div class="pie" style="animation-delay: -2s"></div>
<div class="pie" style="animation-delay: -4s"></div>
<svg class="svg-pie animate" viewBox="0 0 32 32">
<circle r="16" cx="16" cy="16" />
</svg>
<svg class="svg-pie" viewBox="0 0 32 32">
<circle r="16" cx="16" cy="16" stroke-dasharray="25 100" />
</svg>
<div class="future-pie"></div>
<div class="circle"></div>
<p>Circle radius of 16px( 100/2π ) means stroke-dasharray length of 100 == 100%</p>
</body>
</html>