Windows预加载等待动画
教程地址:原文地址(YouTube)
B站教程:原文转载(bilibili)
两个视频的内容相同,第二个为转载
效果图
代码区
html
<div class="container">
<div class="wrapper">
<div class="loader">
<div class="dot">
</div>
</div>
<div class="loader">
<div class="dot">
</div>
</div>
<div class="loader">
<div class="dot">
</div>
</div>
<div class="loader">
<div class="dot">
</div>
</div>
<div class="loader">
<div class="dot">
</div>
</div>
<div class="loader">
<div class="dot">
</div>
</div>
</div>
<div class="text">
Please wait</div>
</div>
CSS
@import url('https://fonts.googleapis.com/css?family=Poppins:400,500,600,700&display=swap');
*{
margin: 0;
padding: 0;
box-sizing: border-box; /* 盒子大小规则 */
}
body{
display: flex; /* 弹性盒布局 */
align-items: center; /* 交叉轴对齐 */
justify-content: center; /* 主轴对齐 */
min-height: 100vh;
text-align: center;
background: #0079d7;
}
.container{
position: relative; /* 相对定位 */
width: 100%;
display: flex;
justify-content: center;
}
.wrapper{
position: absolute;
top: -35px;
transform: scale(2.0); /* 放大倍率 */
}
.loader{
height: 25px;
width: 1px;
position: absolute;
animation: rotate 3.5s linear infinite; /* 动画,时间,线性,重复 */
}
.loader .dot{
top: 30px;
height: 7px;
width: 7px;
background: #fff;
border-radius: 50%;
position: relative;
}
.text{
position: absolute;
bottom: -85px;
font-size: 25px;
font-weight: 400;
font-family: 'Poppins',sans-serif;
color: #fff;
}
@keyframes rotate {
30%{
transform: rotate(220deg); /* 旋转角度 */
}
40%{
transform: rotate(450deg);
opacity: 1;
}
75%{
transform: rotate(720deg);
opacity: 1;
}
76%{
opacity: 0;
}
100%{
opacity: 0;
transform: rotate(0deg);
}
}
.loader:nth-child(1){
animation-delay: 0.15s; /* 动画延时 */
}
.loader:nth-child(2){
animation-delay: 0.3s;
}
.loader:nth-child(3){
animation-delay: 0.45s;
}
.loader:nth-child(4){
animation-delay: 0.6s;
}
.loader:nth-child(5){
animation-delay: 0.75s;
}
.loader:nth-child(6){
animation-delay: 0.9s;
}
JS
// 无
教程地址:原文地址(YouTube)
B站教程:原文转载(bilibili)