html_css_demo/css/95.css

77 lines
1.5 KiB
CSS

*{
/* 初始化 */
margin: 0;
padding: 0;
}
body{
/* 100%窗口高度 */
height: 100vh;
/* 弹性布局 水平+垂直居中 */
display: flex;
justify-content: center;
align-items: center;
background-color: #333;
}
.loader{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.loader .box{
/* 相对定位 */
position: relative;
width: 200px;
height: 200px;
/* 执行动画 */
animation: rotateBox 10s linear infinite;
}
.loader .box .circle{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #f5e866;
border-radius: 50%;
/* 执行动画:动画名 时长 线性的 无限次播放 */
animation: animate 5s linear infinite;
}
.loader .box .circle:nth-child(2){
background-color: #a08fd5;
/* 设置第二个圆的动画延迟时间 */
animation-delay: -2.5s;
}
.loader span{
color: #fff;
font-size: 20px;
font-weight: 500;
margin-top: 30px;
letter-spacing: 4px;
}
/* 定义动画 */
@keyframes animate {
0%{
transform: scale(1);
transform-origin: left;
}
50%{
transform: scale(0);
transform-origin: left;
}
50.01%{
transform: scale(0);
transform-origin: right;
}
100%{
transform: scale(1);
transform-origin: right;
}
}
/* 加个旋转动画 */
@keyframes rotateBox {
to{
transform: rotate(360deg);
}
}