js 让动画暂停

html



js

setTimeout(() => {
document.getElementById('xuanzhuan').style.animationPlayState = 'paused'
            }, 1000)

css

.xuanzhuan {
  animation: rotate 5s linear infinite;
  //animation-iteration-count: 0.5;
}

@keyframes rotate {
  0% {
    transform: rotateZ(0deg); /*从0度开始*/
  }
  100% {
    transform: rotateZ(360deg); /*360度结束*/
  }
}

你可能感兴趣的:(js 让动画暂停)