CSS实现栅栏式loading动画样式

54 阅读1分钟
<div class="bigbox">
  <div class="box"></div>
  <div class="box"></div>
  <div class="box"></div>
  <div class="box"></div>
  <div class="box"></div>
  <div class="box"></div>
  <div class="box"></div>
</div>                                      
.bigbox {
  width: 100%;
  height: 35px;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #005bf5;
  border-color: #005bf5;
  border-radius: 3px;
}

.bigbox div {
  height: 25px;
  width: 2px;
  margin: 5px;
  background: #ddd;
  border-radius: 12px;
}

.bigbox p {
  text-align: center;
  font-size: 18px;
  color: #fff;
}

.bigbox .box:nth-child(1) {
  animation: mymove 500ms ease -600ms infinite alternate;
}

.bigbox .box:nth-child(2) {
  animation: mymove 500ms ease -500ms infinite alternate;
}

.bigbox .box:nth-child(3) {
  animation: mymove 500ms ease -400ms infinite alternate;
}

.bigbox .box:nth-child(4) {
  animation: mymove 500ms ease -300ms infinite alternate;
}

.bigbox .box:nth-child(5) {
  animation: mymove 500ms ease -200ms infinite alternate;
}

.bigbox .box:nth-child(6) {
  animation: mymove 500ms ease -100ms infinite alternate;
}

.bigbox .box:nth-child(7) {
  animation: mymove 500ms ease 000ms infinite alternate;
}

@keyframes mymove {
  /* 2d缩放 */
  from {
    transform: scale(1, 0.3);
  }

  to {
    transform: scale(1, 1);
  }
}

相关链接:www.jianshu.com/p/bd41b19a4…