refactor: loading

This commit is contained in:
xiaoxian521 2021-04-11 01:51:10 +08:00
parent 338bead481
commit ba6e3447a7

View File

@ -17,129 +17,121 @@
<body> <body>
<div id="app"> <div id="app">
<style> <style>
.app-loading { * {
display: flex; margin: 0;
width: 100%; pad: 0;
height: 100%; box-sizing: border-box;
justify-content: center;
align-items: center;
flex-direction: column;
background: #f4f7f9;
} }
.app-loading .app-loading-wrap { section {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: #001d10;
animation: animateBackgroundC0olor 10s linear infinite;
}
@keyframes animateBackgroundC0olor {
0% {
filter: hue-rotate(0deg);
}
100% {
filter: hue-rotate(360deg);
}
}
.loading {
position: relative;
width: 250px;
height: 250px;
}
.loading .blocks {
position: absolute;
width: 8px;
height: 25px;
background-color: #050c09;
left: 50%;
border-radius: 8px;
transform: rotate(calc(18deg * var(--i)));
transform-origin: 0 125px;
animation: animate 1.9s ease-in-out infinite;
animation-delay: calc(0.05s * var(--i));
}
@keyframes animate {
0%,
50% {
background: #050c09;
box-shadow: none;
}
50.1%,
100% {
background: #0f0;
box-sizing: 0 0 5px #0f0,
0 0 15px #0f0,
0 0 30px #0f0,
0 0 60px #0f0,
0 0 90px #0f0;
}
}
h3 {
position: absolute; position: absolute;
top: 50%; top: 50%;
left: 50%; left: 50%;
display: flex; transform: translate(-50%, -50%);
-webkit-transform: translate3d(-50%, -50%, 0); font-size: 2em;
transform: translate3d(-50%, -50%, 0); letter-spacing: 2px;
justify-content: center; animation: animateText 2s ease-in-out infinite;
align-items: center; animation-delay: -1s;
flex-direction: column;
} }
.app-loading .dots { @keyframes animateText {
display: flex;
padding: 98px;
justify-content: center;
align-items: center;
}
.app-loading .app-loading-title { 0%,
display: flex; 50% {
margin-top: 30px; color: #050c09;
font-size: 1.2em; text-shadow: none;
color: rgba(0, 0, 0, 0.85);
justify-content: center;
align-items: center;
}
.dot {
position: relative;
display: inline-block;
width: 48px;
height: 48px;
margin-top: 30px;
font-size: 1.2em;
transform: rotate(45deg);
box-sizing: border-box;
animation: antRotate 1.2s infinite linear;
}
.dot i {
position: absolute;
display: block;
width: 20px;
height: 20px;
background-color: #0065cc;
border-radius: 100%;
opacity: 0.3;
transform: scale(0.75);
animation: antSpinMove 1s infinite linear alternate;
transform-origin: 50% 50%;
}
.dot i:nth-child(1) {
top: 0;
left: 0;
}
.dot i:nth-child(2) {
top: 0;
right: 0;
-webkit-animation-delay: 0.4s;
animation-delay: 0.4s;
}
.dot i:nth-child(3) {
right: 0;
bottom: 0;
-webkit-animation-delay: 0.8s;
animation-delay: 0.8s;
}
.dot i:nth-child(4) {
bottom: 0;
left: 0;
-webkit-animation-delay: 1.2s;
animation-delay: 1.2s;
}
@keyframes antRotate {
to {
-webkit-transform: rotate(405deg);
transform: rotate(405deg);
} }
}
@-webkit-keyframes antRotate { 50.1%,
to { 100% {
-webkit-transform: rotate(405deg); color: #0f0;
transform: rotate(405deg); text-shadow: 0 0 5px #0f0,
} 0 0 15px #0f0;
}
@keyframes antSpinMove {
to {
opacity: 1;
}
}
@-webkit-keyframes antSpinMove {
to {
opacity: 1;
} }
} }
</style> </style>
<div class="app-loading"> <section>
<div class="app-loading-wrap"> <div class="loading">
<div class="app-loading-dots"> <div class="blocks" style="--i:1;"></div>
<span class="dot dot-spin"><i></i><i></i><i></i><i></i></span> <div class="blocks" style="--i:2;"></div>
</div> <div class="blocks" style="--i:3;"></div>
<div class="app-loading-title">vue-pure-admin</div> <div class="blocks" style="--i:4;"></div>
<div class="blocks" style="--i:5;"></div>
<div class="blocks" style="--i:6;"></div>
<div class="blocks" style="--i:7;"></div>
<div class="blocks" style="--i:8;"></div>
<div class="blocks" style="--i:9;"></div>
<div class="blocks" style="--i:10;"></div>
<div class="blocks" style="--i:11;"></div>
<div class="blocks" style="--i:12;"></div>
<div class="blocks" style="--i:13;"></div>
<div class="blocks" style="--i:14;"></div>
<div class="blocks" style="--i:15;"></div>
<div class="blocks" style="--i:16;"></div>
<div class="blocks" style="--i:17;"></div>
<div class="blocks" style="--i:18;"></div>
<div class="blocks" style="--i:19;"></div>
<div class="blocks" style="--i:20;"></div>
<h3>loading</h3>
</div> </div>
</div> </section>
</div> </div>
<script type="module" src="/src/main.ts"></script> <script type="module" src="/src/main.ts"></script>
</body> </body>