上下拉长加载动画效果
html
<!DOCTYPE html>
<html>
<head>
<style>
.container {
display: flex;
justify-content: center;
align-items: center;
width: 150px;
height: 150px;
margin: 50px auto;
}
.rectangle {
width: 20px;
height: 50px;
background-color: #02A0E9;
}
.rectangle ~ .rectangle {
margin-left: 10px;
}
.rectangle:nth-child(1) {
animation: stretch 1.5s ease-in-out infinite 0.1s;
}
.rectangle:nth-child(2) {
animation: stretch 1.5s ease-in-out infinite 0.3s;
}
.rectangle:nth-child(3) {
animation: stretch 1.5s ease-in-out infinite 0.5s;
}
.rectangle:nth-child(4) {
animation: stretch 1.5s ease-in-out infinite 0.7s;
}
.rectangle:nth-child(5) {
animation: stretch 1.5s ease-in-out infinite 0.9s;
}
@keyframes stretch {
0% {
height: 50px;
}
50% {
height: 120px;
}
100% {
height: 50px;
}
}
</style>
</head>
<body>
<div class="container">
<div class="rectangle"></div>
<div class="rectangle"></div>
<div class="rectangle"></div>
<div class="rectangle"></div>
<div class="rectangle"></div>
</div>
</body>
</html>