const box = document.getElementById('box');
let rotation = 0; // 初始旋转角度为 0
function animate() {
rotation += 0.001; // 每次旋转增加 0.1 弧度
box.style.transform = `rotate(${rotation}rad)`; // 更新旋转角度
requestAnimationFrame(animate); // 请求下一次重绘
}
requestAnimationFrame(animate); // 启动动画
<div id="box" style="width: 10px;
height: 10px;
color: red;">5555</div>
#id{
width: 10px;
height: 10px;
color: red;
}