Skip to content

Instantly share code, notes, and snippets.

@mqxu
Created January 28, 2022 12:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mqxu/b9a82a66c2e8266d60467d7bdcd78c9a to your computer and use it in GitHub Desktop.
Save mqxu/b9a82a66c2e8266d60467d7bdcd78c9a to your computer and use it in GitHub Desktop.
加载动画
<div class="container">
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
</div>
.container {
height: 100px;
padding-left: 40px;
margin-top: 40px;
}
.circle {
margin: 20px;
height: 50px;
width: 50px;
border-radius: 50%;
display: inline-block;
transform: scale(0);
animation: bulge 2s infinite ease-in-out;
}
.circle::after {
position: absolute;
display: inline-block;
content: "";
height: 100%;
width: 100%;
border-radius: 50%;
background-color: inherit;
top: 0;
left: 0;
z-index: -1;
transform: scale(1);
animation: blow 2s infinite ease-in-out;
}
.circle:nth-child(1) {
background-color: #4695b8;
animation-delay: 0s;
}
.circle:nth-child(2) {
background-color: #67a142;
animation-delay: 0.25s;
}
.circle:nth-child(3) {
background-color: #8fc0a7;
animation-delay: 0.5s;
}
@keyframes bulge {
50% {
transform: scale(1);
}
}
@keyframes blow {
25% {
opacity: 0.5;
}
50% {
opacity: 0.5;
}
90% {
opacity: 0;
}
100% {
transform: scale(2);
opacity: 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment