html_css_demo/css/93.css

61 lines
1.4 KiB
CSS
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

*{
/* 初始化 */
margin: 0;
padding: 0;
}
body{
/* 100%窗口高度 */
height: 100vh;
/* 弹性布局 水平+垂直居中 */
display: flex;
justify-content: center;
align-items: center;
background-color: #222;
}
.loader{
/* 相对定位 */
position: relative;
width: 250px;
height: 250px;
/* 默认旋转45度 */
transform: rotate(45deg);
/* 执行动画:动画名 时长 线性的 无限次播放 */
animation: roll 2.5s linear infinite;
}
.loader span{
position: absolute;
width: 100%;
height: 100%;
/* 通过var函数获取自定义属性--i计算每一个span元素的旋转角度 */
transform: rotate(calc(90deg * var(--i)));
}
.loader span::before{
content: "";
width: 70px;
height: 70px;
/* 调用自定义属性--c设置背景色 */
background-color: var(--c);
border-radius: 50%;
position: absolute;
/* 默认都居中 */
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
/* 执行动画:动画名 时长 贝塞尔曲线 无限次播放 */
animation: move 2.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) infinite;
}
/* 定义动画 */
@keyframes move {
50%{
left: 0;
box-shadow: 0 0 5px var(--c),
0 0 10px var(--c),
0 0 20px var(--c);
}
}
@keyframes roll {
to{
transform: rotate(360deg);
}
}