效果预览
loding.gif
代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>loading animation</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="loading-screen">
<div class="loading">
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</div>
</body>
</html>
* {
margin: 0;
padding: 0;
}
.loading-screen {
width: 100%;
height: 100vh;
background-color: #2e2e2e;
position: fixed;
display: flex;
align-items: center;
justify-content: center;
}
.loading {
width: 80px;
display: flex;
flex-wrap: wrap;
animation: rotate 1.5s linear infinite;
}
@keyframes rotate {
to {
transform: rotate(360deg)
}
}
.loading span {
width: 32px;
height: 32px;
background-color: red;
margin: 4px;
animation: scale 1.5s linear infinite;
}
@keyframes scale {
50% {
transform: scale(1.2);
}
}
.loading span:nth-child(1) {
border-radius: 50% 50% 0 50%;
background-color: #e77f67;
transform-origin: bottom right;
}
.loading span:nth-child(2) {
border-radius: 50% 50% 0 50%;
background-color: #778beb;
transform-origin: bottom right;
animation-delay: .5s;
}
.loading span:nth-child(3) {
border-radius: 50% 50% 0 50%;
background-color: #f8a5c2;
transform-origin: top right;
animation-delay: 1.5s;
}
.loading span:nth-child(4) {
border-radius: 0 50% 50% 50%;
background-color: #f5cd79;
transform-origin: top left;
animation-delay: 1s;
}
网友评论