新增第134个小实例:简单又别致的环形加载动画

This commit is contained in:
DESKTOP-BM6RJU5\wyanh 2022-04-07 17:27:41 +08:00
parent 5e6a1a52f9
commit ddab273920
3 changed files with 95 additions and 1 deletions

View File

@ -140,4 +140,5 @@
130. HTML5+CSS3小实例传送带式的loading加载动画
131. HTML5+CSS3小实例纯CSS实现打字动画特效
132. HTML5+CSS3+JS小实例上下滚动的数字时钟
133. HTML5+CSS3+JS小实例带标题描述的圆角图片手风琴效果
133. HTML5+CSS3+JS小实例带标题描述的圆角图片手风琴效果
134. HTML5+CSS3小实例简单又别致的环形加载动画

72
code/134/134.css Normal file
View File

@ -0,0 +1,72 @@
*{
margin: 0;
padding: 0;
}
body{
/* 100%窗口高度 */
height: 100vh;
/* 弹性布局 水平+垂直居中 */
display: flex;
justify-content: center;
align-items: center;
/* 渐变背景 */
background: linear-gradient(15deg,#13547a,#80d0c7);
}
.loader{
width: 200px;
height: 200px;
/* 相对定位 */
position: relative;
}
.loader div{
border-width: 5px;
border-style: solid;
border-left-color: #fff;
border-right-color: #fff;
border-top-color: transparent;
border-bottom-color: transparent;
border-radius: 50%;
/* 绝对定位 */
position: absolute;
/* 执行动画:动画名 时长 慢速开始然后变快然后慢速结束 无限次播放 */
animation: spin 2s ease infinite;
}
/* 为每一个圆环设置大小、定位、动画延迟时间 */
.loader div:nth-child(1){
width: 50px;
height: 50px;
left: 70px;
top: 70px;
}
.loader div:nth-child(2){
width: 70px;
height: 70px;
left: 60px;
top: 60px;
/* 动画延迟时间 */
animation-delay: 0.1s;
}
.loader div:nth-child(3){
width: 90px;
height: 90px;
left: 50px;
top: 50px;
animation-delay: 0.2s;
}
.loader div:nth-child(4){
width: 110px;
height: 110px;
left: 40px;
top: 40px;
animation-delay: 0.3s;
}
/* 定义动画 */
@keyframes spin {
50%{
transform: rotate(180deg);
}
100%{
transform: rotate(0);
}
}

21
code/134/134.html Normal file
View File

@ -0,0 +1,21 @@
<!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>简单又别致的环形加载动画</title>
<link rel="stylesheet" href="134.css">
</head>
<body>
<div class="loader">
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</body>
</html>