.box{animation: animate 2s linear infinite;}/* 第三阶段 */@keyframes animate{0%,
100%{transform:rotate(333deg);}50%{transform:rotate(290deg);}}.circle{animation: animateBall 2s linear infinite;}@keyframes animateBall{0%,
100%{transform:rotate(45deg);}50%{transform:rotate(225deg);}}
编写 JS 定时刷新背景
functionchangeBg(){let r = Math.floor(Math.random()*255);let g = Math.floor(Math.random()*255);let b = Math.floor(Math.random()*255);
document.body.style.backgroundColor =`rgba(${r}, ${g}, ${b})`;}setInterval(()=>{changeBg();},4000);