序列帧图转css动态

153 阅读1分钟
//序列帧
.wra {
  position: absolute;
  left: calc(50% - 145px);
  top: calc(40% - 140px);
  width: 8rem;
  height: 8rem;
  overflow: hidden;
}

.wra-box {
  position: absolute;
  width: 128rem;
  height: 8rem;
  background-image: url("../img/spirit.png");
  animation: run 0.8s steps(31, end) infinite;
}
```
@keyframes run {
  0% {
    left: 0;
  }
  100% {
    left: -12rem;
  }
}
```