Created
January 28, 2022 12:16
-
-
Save mqxu/b9a82a66c2e8266d60467d7bdcd78c9a to your computer and use it in GitHub Desktop.
加载动画
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="container"> | |
<div class="circle"></div> | |
<div class="circle"></div> | |
<div class="circle"></div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.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