js jq如何把div画出圆型轨迹
网上的例子是:
for(i;i<800;i++)
{
a=100*Math.sin(i)+300
b=100*Math.cos(i)+300
document.write("<div style='width:1px;height:1px;background:red;left:"+a+";top:"+b+";position:absolute;overflow:hidden'>")
document.write("</div>")
}
这个是圆形轨迹。
我做的修改:
function round(r){ //sun的轨迹
var x=0,r;
//roundFlag = true;
for(x=0;x<r;x++){
a=100*Math.sin(x)+478;
b=100*Math.cos(x)+40;
$('#sun').animate({"left":a,"top":b},5000);
}
//roundFlag = false;
}
round(30);
画出的不是圆形。 如何修改呢?
跟帖
暂无
说几句