-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
230 lines (202 loc) · 8.31 KB
/
index.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SVG Spinner</title>
<style>
.loader_svg{
position: absolute;
width: 100%;
height: 100%;
}
.loader_polygons{
opacity:0.5;
stroke-width: 0.5;
stroke: #799b79;
fill: none;
transition: stroke 0.3s 0.9s;
}
.loader_plus {
opacity: 1;
fill: #FF3131;
animation: fade 1s infinite;
transition: fill 0.15s;
}
.loader_innercircle_1{
fill: #00FFFF;
animation: rotate 4s infinite linear;
transform-origin: 53% 52%;
transition: fill 0.15s;
}
.loader_innercircle_2{
opacity: 0.8;
fill: #00FFFF;
animation: rotate 2s infinite linear reverse;
transform-origin: 53% 52%;
transition: fill 0.15s 0.15s;
}
.loader_innercircle_3{
opacity: 0.8;
fill: #00FFFF;
animation: rotate 1s infinite linear;
transform-origin: 53% 52%;
transition: fill 0.15s 0.3s;
}
.loader_innercircle_4{
fill: #00FFFF;
animation: rotate 2.5s infinite reverse linear;
transform-origin: 53% 52%;
transition: fill 0.15s 0.45s;
}
.loader_innercircle_5{
fill: #00FFFF;
animation: rotate 2s infinite reverse linear;
transform-origin: 53% 52%;
transition: fill 0.15s 0.6s;
}
.loader_innercircle_6{
opacity: 0.8;
fill: #00FFFF;
animation: rotate 1s infinite linear;
transform-origin: 53% 52%;
transition: fill 0.15s 0.75s;
}
.loader_pointer{
fill: none;
stroke-width: 1.5;
stroke: #39FF14;
transition: stroke 0.15s 0.9s;
}
/* remove loader */
.loader_container.failure,
.loader_container.success{
transition: height 0.3s linear 1.2s, width 0.3s linear 1.6s;
height: 0.1rem;
width: 0.1rem;
}
/* Change the hover with a failure class */
.loader_svg.failure .loader_plus,
.loader_svg.failure .loader_innercircle_1,
.loader_svg.failure .loader_innercircle_2,
.loader_svg.failure .loader_innercircle_3,
.loader_svg.failure .loader_innercircle_4,
.loader_svg.failure .loader_innercircle_5,
.loader_svg.failure .loader_innercircle_6{
fill: #FF3131;
}
.loader_svg.failure .loader_pointer,
.loader_svg.failure .loader_polygons{
stroke: #FF3131;
}
/* Change the active with a success class */
.loader_svg.success .loader_plus,
.loader_svg.success .loader_innercircle_1,
.loader_svg.success .loader_innercircle_2,
.loader_svg.success .loader_innercircle_3,
.loader_svg.success .loader_innercircle_4,
.loader_svg.success .loader_innercircle_5,
.loader_svg.success .loader_innercircle_6{
fill: #39FF14;
}
.loader_svg.success .loader_pointer,
.loader_svg.success .loader_polygons{
stroke: #39FF14;
}
@keyframes fade{
0%, 100%{
opacity: 1;
}
50%{
opacity: 0;
}
}
@keyframes rotate{
to{
transform: rotate(360deg);
}
}
</style>
</head>
<body>
<svg class="loader_svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
<g>
<g class="loader_polygons">
<polygon points="41.5 62 30 62 24.2 72 30 82 41.5 82 47.3 72" />
<polygon points="58.8 72 47.3 72 41.5 82 47.3 92 58.8 92 64.6 82" />
<polygon points="76.2 62 64.6 62 58.8 72 64.6 82 76.2 82 81.9 72" />
<polygon points="41.5 42 30 42 24.2 52 30 62 41.5 62 47.3 52" />
<polygon points="58.8 12 47.3 12 41.5 22 47.3 32 58.8 32 64.6 22" />
<polygon points="58.8 32 47.3 32 41.5 42 47.3 52 58.8 52 64.6 42" />
<polygon points="76.2 22 64.6 22 58.8 32 64.6 42 76.2 42 81.9 32" />
</g>
<polygon class="loader_plus" points="57.4 51.5 53.5 51.5 53.5 47.7 52.6 47.7 52.6 51.5 48.7 51.5 48.7 52.5 52.6 52.5 52.6 56.3 53.5 56.3 53.5 52.5 57.4 52.5" />
<g class="loader_innercircle_1">
<path d="M48.3 56.8l-4.4 1.5c-0.9-1.3-1.5-2.7-1.7-4.3l-1.9 0.3c0.5 2.6 1.7 5 3.6 6.9c1.9 1.9 4.3 3.1 6.9 3.6 l0.3-1.9c-1.6-0.3-3-0.9-4.3-1.7L48.3 56.8z" />
<path d="M57.8 47.2l4.4-1.5c0.9 1.3 1.5 2.7 1.7 4.3l1.9-0.3c-0.5-2.6-1.7-5-3.6-6.9c-1.9-1.9-4.3-3.1-6.9-3.6L55 41.1 c1.6 0.3 3 0.9 4.3 1.7L57.8 47.2z" />
<path d="M62.2 58.2l-4.4-1.5l1.5 4.4C58 62 56.5 62.6 55 62.9l0.3 1.9c2.6-0.5 5-1.7 6.9-3.6c1.9-1.9 3.1-4.3 3.6-6.9 L64 53.9C63.7 55.5 63.1 56.9 62.2 58.2z" />
<path d="M43.9 42.8c-1.9 1.9-3.1 4.3-3.6 6.9l1.9 0.3c0.3-1.6 0.9-3 1.7-4.3l4.4 1.5l-1.5-4.4c1.3-0.9 2.7-1.5 4.3-1.7 l-0.3-1.9C48.2 39.7 45.8 40.9 43.9 42.8z" />
</g>
<g class="loader_innercircle_2">
<path d="M36 61.9c-1.7-3-2.7-6.4-2.7-9.9c0-10.9 8.8-19.7 19.7-19.7v1c-10.3 0-18.8 8.4-18.8 18.8 c0 3.3 0.9 6.5 2.5 9.4L36 61.9z" />
</g>
<g class="loader_innercircle_3">
<path d="M57 75.3l-0.5-3c9.9-1.7 17.2-10.2 17.2-20.3c0-11.4-9.2-20.6-20.6-20.6S32.5 40.6 32.5 52 c0 1.6 0.2 3.2 0.5 4.7l-3 0.7c-0.4-1.8-0.6-3.6-0.6-5.4c0-13.1 10.6-23.7 23.7-23.7S76.7 38.9 76.7 52 C76.7 63.6 68.4 73.4 57 75.3z" />
</g>
<g class="loader_innercircle_4">
<path d="M39.7 28.5l0.6 1c3.9-2.2 8.3-3.4 12.8-3.4V25C48.4 25 43.7 26.2 39.7 28.5z" />
<path d="M28.6 60.6l-1.1 0.4C31.3 71.8 41.6 79 53.1 79v-1.2C42.1 77.9 32.3 70.9 28.6 60.6z" />
</g>
<g class="loader_innercircle_5">
<path d="M90.5 45.4c-1.5-8.8-6.2-16.8-13-22.5l0 0c-3.4-2.9-7.3-5.1-11.4-6.6s-8.5-2.3-13-2.3v2.4v1.4v2.4 c3.7 0 7.4 0.6 10.9 1.9l0.8-2.3c0 0 0 0 0 0c3.7 1.4 7.2 3.4 10.3 5.9l1.2-1.5L75 25.8c0 0 0 0 0 0l-1.5 1.8 c5.7 4.8 9.6 11.5 10.9 18.8l3.8-0.7c0 0 0 0 0 0L90.5 45.4z"
/>
<path d="M29.7 22l4.7 6.1c3.5-2.8 7.5-4.6 11.9-5.6l-1.7-7.5C39.2 16.2 34.2 18.5 29.7 22z" />
</g>
<g class="loader_innercircle_6">
<path d="M53.1 92.4v-1c21.8 0 39.5-17.7 39.5-39.5c0-21.8-17.7-39.5-39.5-39.5c-15.8 0-30 9.4-36.2 23.8L15.9 36 c6.4-14.8 21-24.4 37.1-24.4c22.3 0 40.4 18.1 40.4 40.4C93.5 74.3 75.3 92.4 53.1 92.4z" />
</g>
<g class="loader_pointer">
<polyline points="35.5 77.5 27.5 89.5 24 89.5" />
<rect height="7" width="17" y="86" x="7" />
</g>
<g class="loader_pointer">
<polyline points="59 22 69 12 82 12" />
<circle r="5" cy="12" cx="87" />
</g>
</g>
</svg>
<script>
const svgLoader = document.querySelector('.loader_svg');
const addSuccess = () => {
svgLoader.classList.add('success');
};
const removeSuccess = () => {
svgLoader.classList.remove('success');
};
const addFailure = () => {
svgLoader.classList.add('failure');
};
const removeFailure = () => {
svgLoader.classList.remove('failure');
};
const fns = [
() => {
removeFailure();
addSuccess();
},
() => {
removeSuccess();
addFailure();
},
() => {
removeFailure();
removeSuccess();
}
];
setInterval(() => {
const index = Math.floor(Math.random() * 3);
fns[index]();
}, 5000);
</script>
</body>
</html>