【问题标题】:Keyframe animation flickering on scaling Firefox缩放 Firefox 时关键帧动画闪烁
【发布时间】:2018-07-20 07:02:43
【问题描述】:

您好,我已经创建了一个可以在不同设备上以不同分辨率运行的游戏。所以要调整分辨率,我正在使用动态 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;
}
}

【问题讨论】:

    标签: javascript html css css-animations scaling


    【解决方案1】:

    -webkit-transform-style: preserve-3d;-moz-transform-style: preserve-3d;style 添加到闪烁元​​素的容器中。 class="container" 在您的情况下,包含 .boboFeather 元素。

    【讨论】:

    猜你喜欢
    • 2012-09-26
    • 2018-10-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-22
    • 2015-09-11
    • 2016-11-07
    • 2012-10-16
    相关资源
    最近更新 更多