背景图片CSS动画

use*_*047 2 css animation transform

我们正在Safari中专门针对这个空白问题(http://take.ms/xuQJS)进行以下演示?

演示:https://codepen.io/anon/pen/WZBeMG

我们无法找到问题的根源,任何帮助表示赞赏.考虑一下我们只想transform在动画中使用.

Jus*_*nas 5

.scroll太短了.试试.scroll {width: 200%}.现在你有宽度100%,你移动你的元素-500px,所以会有差距.

*, *:before, *:after {
  box-sizing: border-box;
}

@-webkit-keyframes scrollGood {
  0% {
    -webkit-transform: translate3d(0, 0, 0);
            transform: translate3d(0, 0, 0);
  }
  100% {
    -webkit-transform: translate3d(-500px, 0, 0);
            transform: translate3d(-500px, 0, 0);
  }
}
@keyframes scrollGood {
  0% {
    -webkit-transform: translate3d(0, 0, 0);
            transform: translate3d(0, 0, 0);
  }
  100% {
    -webkit-transform: translate3d(-500px, 0, 0);
            transform: translate3d(-500px, 0, 0);
  }
}
.pen {
  background-color: blue;
  position: absolute;
  top: 0px;
  left: 0px;
  height: 100%;
  width: 100%;
}

.panel {
  padding: 3rem;
  height: 100%;
}

.bottom {
  background-color: #31CC70;
  overflow: hidden;
  position: relative;
}
.bottom .scroll {
  background-image: url(http://scarbroughstudios.com/img/codepen.svg);
  background-position: center center;
  background-size: 500px;
  position: absolute;
  top: 0px;
  left: 0px;
  height: 400%;
  width: 200%;
  z-index: 1;
  -webkit-animation: scrollGood 5s linear infinite;
  animation: scrollGood 5s linear infinite;
}
Run Code Online (Sandbox Code Playgroud)
<section class="pen">
<div class="panel bottom">
  <div class="scroll"></div>
</div>
</section>
Run Code Online (Sandbox Code Playgroud)