-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdemo.html
63 lines (62 loc) · 1.64 KB
/
demo.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
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="UTF-8">
<title>Circle Progress Demo</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=11">
<meta name="format-detection" content="telephone=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<style>
body {
text-align: center
}
.grid {
display: inline-block;
width: 200px;
height: 200px;
margin: 50px;
}
#b {
width: 200px;
height: 200px;
}
</style>
</head>
<body>
<div class="grid">
<canvas id="a" width='200' height='200'></canvas>
<input id="a_slide" type="range" min='0' max='100'>
<button id="a_restart">restart</button>
</div>
<div class="grid">
<div id="b"></div>
<input id="b_slide" type="range" min='0' max='100'>
<button id="b_restart">restart</button>
</div>
<script src="hidpi-canvas-polyfill.js"></script>
<script src="circleProgress.min.js"></script>
<script>
var a = new CircleProgress({
element: document.getElementById('a'),
current: 0.23
})
document.getElementById('a_slide').addEventListener('input', function(e) {
a.draw(e.target.value / 100)
})
document.getElementById('a_restart').addEventListener('click', function(e) {
a.restart()
})
var b = new CircleProgress({
element: document.getElementById('b'),
current: 0.89
})
document.getElementById('b_slide').addEventListener('input', function(e) {
b.draw(e.target.value / 100)
})
document.getElementById('b_restart').addEventListener('click', function(e) {
b.restart()
})
</script>
</body>
</html>