Safari(移动+桌面)分组CSS关键帧动画

时间:2013-03-19 16:43:29

标签: css safari transform css-transitions webkit-transform

我在使用Safari时遇到问题,除了羽毛外,还会模仿浮在空中的气泡效果。我省略了一些代码来了解事物的要点。正在进行的工作的网址是here

以下是我的动画对象的webkit样式。

@-webkit-keyframes f1 {
  100% {
    -webkit-transform: translateX(-25px) translateY(-350px); 
  } 
}

.feather {
  /* other styling omitted */
  -webkit-animation-duration: 7s;
  -webkit-animation-timing-function: linear;
}

用javascript创建一堆对象。

animateFeathers = function() {
    var $feather = $('<img>'),
    $feather.addClass('feather animated');
    $feather.attr('src','img/feather.png');
    $feather.css('-webkit-animation-name','f1');
    $featherContainer.append($feather);

    setTimeout(function() {
        $feather.remove();
    }, 9000);

    // random time to create next feather
    var rTimeout = Math.random() * maxTime + minTime;
    setTimeout(animateFeathers, rTimeout);
}

如果您访问Chrome或Firefox中的link,您会看到预期效果。然而,在Safari(再次,移动或桌面)中,羽毛堆叠并且每7秒仅在一组中生成动画。我希望他们一旦插入DOM就开始动画。关于这个的任何想法?

1 个答案:

答案 0 :(得分:0)

不得不求助于使用画布,因为我无法在Safari上获得性能。花了几个小时,但它的工作:

http://poetreatapp.com/

相关问题