LoadingView.vue
1.3 KB
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
<template>
<view class="background">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</view>
</template>
<script>
export default {
name: "LoadingView",
data() {
return {
};
}
}
</script>
<style>
.background {
width: 100vw;
height: 100vh;
--amount: 20;
}
$animationDuration: 3s;
$amount: 6;
$particleRadius: 4vmin;
.background span {
width: $particleRadius * 2;
height: $particleRadius * 2;
border-radius: $particleRadius;
backface-visibility: hidden;
position: absolute;
animation-name: move;
animation-timing-function: cubic-bezier(0.4, 0, 1, 0.8);
animation-iteration-count: infinite;
animation-duration: $animationDuration;
top: calc(50% - #{$particleRadius});
left: 50%;
transform-origin: ($particleRadius * -1) center;
$colors: (#c5f0a4, #35b0ab, #226b80);
@for $i from 1 through $amount {
&:nth-child(#{$i}) {
background: nth($colors, random(length($colors)));
animation-delay: ($i / $amount) * $animationDuration * -1;
opacity: 0;
}
}
}
@keyframes move {
0% {
transform: scale(1) rotate(0deg) translate3d(0, 0, 1px);
}
30% {
opacity: 1;
}
100% {
z-index: 10;
transform: scale(0) rotate(360deg) translate3d(0, 0, 1px);
}
}
</style>