css animate属性写的平移动画卡顿

这是我用了的属性,还少了什么?

.topDiv .cloundBig{
    width: 10rem;
    animation-duration:8s;
    animation-name: cloundBig;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    animation-direction: alternate;
}
@-webkit-keyframes cloundBig {
    0% { margin-left: 50% }
    100% { margin-left: 60% }
}
阅读 6.9k
3 个回答

平移建议使用 transform ,因为margin会引起重绘 消耗性能

animation: name duration timing-function delay iteration-count direction;

还有 卡顿发生在什么浏览器?

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题