缩放Firefox时关键帧动画闪烁

时间:2018-07-20 07:02:44

标签: javascript html5 css3 css-animations scaling

您好,我创建了一个可以在不同分辨率的不同设备上运行的游戏。因此,为了调整分辨率,我使用了动态CSS缩放,因此由于缩放,我的关键帧动画在Firefox上大量闪烁。 Sprite动画用于div background-imgae中。请帮助我摆脱这种情况。 以下是动画的源代码和url:

请在Firefox中打开它。

https://trcdev.oupchina.com.hk/test/kg_game3/#/home

.boboFeather {
background-image: url(‘../../assets/images/home/boboFeather.png’);
background-repeat: no-repeat;
width: 460px;
height: 489px;
position: absolute;
right: 250px;
bottom: 30px;
animation: BoboFeatherAnim 2s steps(14) infinite;
-webkit-animation: BoboFeatherAnim 2s steps(14) infinite;
-moz-animation: BoboFeatherAnim 2s steps(14) infinite;
-ms-animation: BoboFeatherAnim 2s steps(14) infinite;
-o-animation: BoboFeatherAnim 2s steps(14) infinite;
transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
}

@keyframes BoboFeatherAnim {
from {
background-position: 0px;
}
to {
background-position: -6440px;
}
}

@-moz-keyframes BoboFeatherAnim {
from {
background-position: 0px;
}
to {
background-position: -6440px;
}
}

@-ms-keyframes BoboFeatherAnim {
from {
background-position: 0px;
}
to {
background-position: -6440px;
}
}

@-o-keyframes BoboFeatherAnim {
from {
background-position: 0px;
}
to {
background-position: -6440px;
}
}

@-webkit-keyframes BoboFeatherAnim {
from {
background-position: 0px;
}
to {
background-position: -6440px;
}
}

1 个答案:

答案 0 :(得分:0)

向闪烁元素的容器添加-webkit-transform-style: preserve-3d;-moz-transform-style: preserve-3d;样式。对于您的情况下的class="container",其中包含.boboFeather元素。