59 lines
1.3 KiB
CSS
59 lines
1.3 KiB
CSS
*{
|
|
/* 初始化 */
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
body{
|
|
/* 100%窗口高度 */
|
|
height: 100vh;
|
|
/* 弹性布局 水平+垂直居中 */
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
background-color: #000;
|
|
}
|
|
.loader{
|
|
/* 相对定位 */
|
|
position: relative;
|
|
width: 240px;
|
|
height: 240px;
|
|
/* 渐变背景 金色到透明 */
|
|
background: linear-gradient(gold,transparent 40%);
|
|
border-radius: 50%;
|
|
/* 执行动画:动画名 时长 线性 无限次播放 */
|
|
animation: roll 1s linear infinite;
|
|
}
|
|
/* 遮罩层 */
|
|
.loader::before{
|
|
content: "";
|
|
width: calc(100% - 20px);
|
|
height: calc(100% - 20px);
|
|
background-color: #000;
|
|
/* 绝对定位 居中 */
|
|
position: absolute;
|
|
left: 50%;
|
|
top: 50%;
|
|
transform: translate(-50%,-50%);
|
|
border-radius: 50%;
|
|
}
|
|
.loader::after{
|
|
content: "";
|
|
position: absolute;
|
|
width: 100%;
|
|
height: 100%;
|
|
background: linear-gradient(gold,transparent 40%);
|
|
border-radius: 50%;
|
|
/* 模糊滤镜 */
|
|
filter: blur(30px);
|
|
z-index: -1;
|
|
}
|
|
|
|
/* 定义动画 */
|
|
@keyframes roll{
|
|
to{
|
|
transform: rotateZ(360deg);
|
|
/* 转动时再加个颜色变化 */
|
|
/* 颜色滤镜 通过设置度数可改变颜色 */
|
|
filter: hue-rotate(360deg);
|
|
}
|
|
} |