js 让动画暂停

js yekong 256℃

html

<img src="../images/tagbg.png" id="xuanzhuan" class="xuanzhuan tagbg" alt="">

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度结束*/
  }
}

喜欢 (0)