【发布时间】:2020-01-07 19:59:40
【问题描述】:
我正在努力提高关键帧动画的流畅度。它似乎在桌面上完美运行,但在移动设备上非常滞后且不流畅。我需要如何更改我的代码以使其顺利进行?
见 JSBin:https://jsbin.com/hecifu/6/edit?html,css,js,output
@keyframes overlayAnimation {
0% {
width: 100vw;
height: 100vh;
transform: translate3d(0px, 0px, 0);
background: transparent;
}
25%{
width: 10px;
height: 200px;
transform: translate3d(calc(50vw - 5px), calc(50vh - 100px), 0);
}
50%{
width: 10px;
height: 200px;
transform: translate3d(calc(50vw - 5px), calc(50vh - 100px), 0) rotate(90deg);
}
50.1%{
width: 200px;
height: 10px;
transform: translate3d(calc(50vw - 100px), calc(50vh - 5px), 0) rotate(0deg);
}
75%{
width: 200px;
height: 100vh;
transform: translate3d(calc(50vw - 100px), 0px, 0) rotate(0deg);
}
100%{
width: 100vw;
height: 100vh;
transform: translate3d(0px, 0px, 0) rotate(0deg);
visibility:hidden;
}
【问题讨论】:
-
您是否尝试过添加和删除 will-change 以让浏览器注意到动画将会发生?
-
你能举个例子吗?
标签: css animation css-transitions