css3 – 动画CSS背景位置与平滑的结果(子像素动画)

我正在试图动画一个div的背景位置,慢慢地,但没有它的动作.您可以在这里查看我目前的努力结果:

http://jsfiddle.net/5pVr4/2/

@-webkit-keyframes MOVE-BG {
    from {
        background-position: 0% 0%
    }
    to { 
        background-position: 187% 0%
    }
}

#content {
    width: 100%;
    height: 300px;
    background: url(http://www.gstatic.com/webp/gallery/1.jpg) 0% 0% repeat;
    text-align: center;
    font-size: 26px;
    color: #000;

    -webkit-animation-name: MOVE-BG;
    -webkit-animation-duration: 100s;
    -webkit-animation-timing-function: linear;
    -webkit-animation-iteration-count: infinite;
}

我已经在这几个小时,找不到任何将在亚像素级别缓慢而顺利的动画.我当前的例子是从这个页面上的示例代码http://css-tricks.com/parallax-background-css3/

在这页面的translate()示例中可以看到动画的平滑度.

http://css-tricks.com/tale-of-animation-performance/

如果不能使用背景位置,是否有一种方式来伪造多个div的重复背景,并使用翻译移动这些div?

解决方法

结帐这个例子:

http://jsfiddle.net/5pVr4/4/

<div id="content">Foreground content
  <div class="bg"></div>
</div>

@-webkit-keyframes MOVE-BG {
   from {
     -webkit-transform: translateX(0);
   }
   to { 
     -webkit-transform: translateX(-187%);
   }
}

#content {
  height: 300px;
  text-align: center;
  font-size: 26px;
  color: #000;
  position:relative;
}

.bg{
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: -1;
  background: url(http://www.gstatic.com/webp/gallery/1.jpg) 0% 0% repeat;

  -webkit-animation-name: MOVE-BG;
  -webkit-animation-duration: 100s;
  -webkit-animation-timing-function: linear;
  -webkit-animation-iteration-count: infinite;
}

相关文章

Css3如何实现鼠标移上变长特效?(图文+视频)
css3怎么实现鼠标悬停图片时缓慢变大效果?(图文+视频)
jquery如何实现点击网页回到顶部效果?(图文+视频)
css3边框阴影效果怎么做?(图文+视频)
css怎么实现圆角边框和圆形效果?(图文+视频教程)
Css3如何实现旋转移动动画特效