原生JS实现圆周运动
<body>
<div id="ball" style="width:20px; height:20px; background:red; border-radius:50%; position:absolute; left:0; top:80px;"></div>
<script>
var ball = document.getElementById("ball");
var radian = 0.1;
var x = 0;
var y = 0;
document.onmousemove = function(e){
e = e || event;
x = e.clientX;
y = e.clientY;
}
var timer1 = setInterval(function(){
ball.style.left = x + Math.cos(radian) * 80 + "px";
ball.style.top = y + Math.sin(radian) * 80 + "px";
radian+=0.1;
},20);
</script>
</body>