更新时间:2021-12-23 04:45:24
如果要使用CSS制作动画,为什么不使用纯CSS? 您可以将animation属性包装在Class中,然后在JS中切换该类.
If you're animating with css why not using pure CSS? You can wrap the animation property in a Class and toggle that class in JS.
div {
-webkit-animation:anim 2s ease infinite;
}
@-webkit-keyframes anim
{
0 {-webkit-transform:rotate(0deg);}
50% {-webkit-transform:rotate(1deg);}
100% {-webkit-transform:rotate(0deg);}
}