新增第85个小实例:莫比乌斯环loading动画

This commit is contained in:
DESKTOP-BM6RJU5\wyanh 2021-12-31 20:45:27 +08:00
parent 4d4d1be7b2
commit 8155b021a4
3 changed files with 114 additions and 1 deletions

View File

@ -88,4 +88,5 @@
81. HTML5+CSS3+JS小实例滑动切换的注册登录界面
82. HTML5+CSS3小实例篮球弹跳动画
83. HTML5+CSS3+JS小实例马赛克背景的按钮特效
84. HTML5+CSS3小实例翻书动画
84. HTML5+CSS3小实例翻书动画
85. HTML5+CSS3小实例莫比乌斯环loading动画

83
css/85.css Normal file
View File

@ -0,0 +1,83 @@
*{
/* 初始化 */
margin: 0;
padding: 0;
}
body{
/* 100%窗口高度 */
height: 100vh;
/* 弹性布局 水平+垂直居中 */
display: flex;
justify-content: center;
align-items: center;
background-color: #333;
}
.loader{
display: flex;
justify-content: center;
align-items: center;
/* 相对定位 */
position: relative;
left: 7.5px;
}
.loader::before,
.loader::after{
content: "";
width: 150px;
height: 150px;
border-radius: 50%;
border: 15px solid #57606f;
box-sizing: border-box;
position: relative;
z-index: -1;
}
.loader::after{
left: -15px;
}
.loader div{
width: 150px;
height: 150px;
/* 绝对定位 */
position: absolute;
left: 0;
/* 利用clip-path的方式遮盖掉下半部分 */
clip-path: polygon(0 0,100% 0,100% 50%,0 50%);
}
.loader div div{
width: 150px;
height: 150px;
box-sizing: border-box;
border-style: solid;
border-width: 15px;
border-color: #ff6b81 #ff6b81 transparent transparent;
border-radius: 50%;
/* 默认旋转135度让圆环处于遮盖处 */
transform: rotate(135deg);
animation: roll 4s linear infinite;
}
.lb{
transform: scale(-1,-1);
}
.rt{
transform: translateX(calc(100% - 15px)) scale(-1,1);
}
.rb{
transform: translateX(calc(100% - 15px)) scale(1,-1);
}
/* 接下来设置动画延迟 */
.loader .rb div{
animation-delay: 1s;
}
.loader .rt div{
animation-delay: 2s;
}
.loader .lb div{
animation-delay: 3s;
}
/* 定义动画 */
@keyframes roll {
50%,100%{
transform: rotate(495deg);
}
}

29
html/85.html Normal file
View File

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<title>莫比乌斯环loading动画</title>
<link rel="stylesheet" href="../css/85.css">
</head>
<body>
<div class="loader">
<div class="lt">
<div></div>
</div>
<div class="lb">
<div></div>
</div>
<div class="rt">
<div></div>
</div>
<div class="rb">
<div></div>
</div>
</div>
</body>
</html>