javascript - 缩放 Firefox 时关键帧动画闪烁
问题描述
嗨,我创建了一个可以在不同设备上以不同分辨率运行的游戏。所以要调整分辨率,我正在使用动态 css 缩放,所以由于缩放,我的关键帧动画在 Firefox 上大量闪烁。sprite 动画在 div background-imgae 中使用。请帮助我摆脱这种情况。下面是动画的源代码和url:
请用火狐打开。
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;
}
}
解决方案
向闪烁元素的容器添加-webkit-transform-style: preserve-3d;
或设置样式。-moz-transform-style: preserve-3d;
在class="container"
您的情况下,它包含.boboFeather
元素。
推荐阅读
- icalendar - 有没有办法导出 Mura 日历?
- delphi - 使用 Dblookupcombobox 过滤表中的相似记录
- c++ - 在n维中查找矩形的坐标
- jquery - fullpage.js 网站上的垂直导航魔术标记突出显示
- html - 使立方体填满整个屏幕
- c# - 将 "\n" 转换为实际的新行
- apache-spark - 如何将 Spark 2.4 的外部 avro 包包含到 Junit 中?
- vb.net - 功能区组合框在重新加载中丢失了值
- laravel - 我无法解决 Laravel 中的“方法不允许的异常”
- node.js - Stripe API 未处理的拒绝响应错误