# 圆形轨迹
function yuan(obj,x,y,s){
var num = 0;
setInterval(function(){
var a = Math.sin(num*Math.PI/180)*s;
console.log("a:"+a)
var b = Math.cos(num*Math.PI/180)*s;
console.log("b:"+b)
obj.style.top=y+a+"px";
obj.style.left=(x-250)+b+"px";
num++;
if (num>360)
{
num=0
}
}, 50)
}
网友评论