原因是当x极限于半径200时,y太小了以致于浏览器无法处理(复制保存代码就可以运行了)。
<style>
body{margin:0;}
.cricle{width:100%;height:100%;position:absolute;margin-left:-50%;top:50%}
span{position:absolute;border:1px solid}
</style>
<div class=cricle>
<span style='top:culc(50% -200 px);left:50%'></span>
</div>
<script src="https://cdn.bootcss.com/jquery/1.10.2/jquery.min.js">
</script>
<script>
width=$(window).width()/2
height=$(window).height()/2
r=200
x=width
y=height-200
i=0
function draw_square(){
if(i<200) { x=x+1; y=-Math.sqrt(40000-(x-width)*(x-width))}
if(i>=200 && i<400){ x=x-1 ; y=Math.sqrt(40000-(x-width)*(x-width))}
if(i>=400 && i<600 ){ x=x-1 ;y=Math.sqrt(40000-(x-width)*(x-width))}
if(i>=600 && i<800 ){ x=x+1 ;y=-Math.sqrt(40000-(x-width)*(x-width))}
$('.cricle>span:last').append("<span style='top:"+y+";left:"+x+"'></span>")
i=i+1
setTimeout(draw_square,2)
}
draw_square()
</script>