简体   繁体   English

如何提高此CSS动画的性能?

[英]How to improve the performance of this CSS animation?

I am using Chrome and a pure pulse CSS animation 我正在使用Chrome和纯pulse CSS动画

.pulse {
  width: 20px;
  height: 20px;
  vertical-align: middle;
  background-color: #53A653;
  border-radius: 100%;  
  -webkit-animation: scaleout 3.0s infinite ease-in-out;
  animation: scaleout 3.0s infinite ease-in-out;
}



@-webkit-keyframes scaleout {
  0% { -webkit-transform: scale(0.0) }
  100% {
    -webkit-transform: scale(1.0);
    opacity: 0;
  }
}

Here is the jsfiddle . 这是jsfiddle

I noticed that it is quite slow. 我注意到它很慢。 Once I run it, the scrolling of the other windows of Chrome becomes not smooth and even now my typing is a little bit chunking. 一旦运行它,Chrome其他窗口的滚动将变得不平滑,即使现在我的输入也有些分块。

Is CSS animation really this slow? CSS动画真的慢吗? or my CSS is just very bad? 还是我的CSS非常糟糕? How to improve its performance? 如何提高其性能?

Try changing your animation duration to 1s: 尝试将动画持续时间更改为1s:

.pulse {width: 20px; height: 20px; vertical-align: middle;background-color: #53A653; border-radius: 100%; -webkit-animation: scaleout 1.0s infinite ease-in-out; animation: scaleout 1.0s infinite ease-in-out;}

EDIT: I forgot to read the line says how your scrolling became chunky. 编辑:我忘了读那行说你的滚动如何变得矮胖。 Try using Firefox (stupid suggestion). 尝试使用Firefox(愚蠢的建议)。 If not, it's most likely just your computer. 如果没有,则很可能只是您的计算机。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM