-
Notifications
You must be signed in to change notification settings - Fork 66
/
progress_bar.js
90 lines (85 loc) · 1.94 KB
/
progress_bar.js
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
var lineBar = new ProgressBar.Line("#line-container", {
strokeWidth: 4,
trailWidth: 0.5,
from: { color: "#FF9900" },
to: { color: "#00FF99" },
text: {
value: '0',
className: 'progress-text',
style: {
color: 'black',
position: 'absolute',
top: '-30px',
padding: 0,
margin: 0,
transform: null
}
},
step: (state, shape) => {
shape.path.setAttribute("stroke", state.color);
shape.setText(Math.round(shape.value() * 100) + ' %');
}
});
lineBar.animate(1, {
duration: 4000
});
var circleBar = new ProgressBar.Circle("#circle-container", {
color: "white",
strokeWidth: 2,
trailWidth: 25,
trailColor: "black",
easing: "easeInOut",
from: { color: "#FF9900", width: 1 },
to: { color: "#FF0099", width: 25 },
text: {
value: '0',
className: 'progress-text',
style: {
color: 'black',
position: 'absolute',
top: '45%',
left: '42%',
padding: 0,
margin: 0,
transform: null
}
},
step: (state, shape) => {
shape.path.setAttribute("stroke", state.color);
shape.path.setAttribute("stroke-width", state.width);
shape.setText(Math.round(shape.value() * 100) + ' %');
}
});
circleBar.animate(0.75, {
duration: 1500
});
var semiBar = new ProgressBar.SemiCircle("#semi-container", {
color: "violet",
strokeWidth: 2,
trailWidth: 8,
trailColor: "black",
easing: "bounce",
from: { color: "#FF0099", width: 1 },
to: { color: "#FF9900", width: 2 },
text: {
value: '0',
className: 'progress-text',
style: {
color: 'black',
position: 'absolute',
top: '45%',
left: '50%',
padding: 0,
margin: 0,
transform: null
}
},
step: (state, shape) => {
shape.path.setAttribute("stroke", state.color);
shape.path.setAttribute("stroke-width", state.width);
shape.setText(Math.round(shape.value() * 100) + ' %');
}
});
semiBar.animate(0.75, {
duration: 2000
});