一个nice的面试官对面试经验匮乏者的温暖To snow peak,哈哈
drawRadial(100, 100, 30, 10)
/**
*@description
*用canvas画放射图
*
*@params
*x0、y0原点坐标,r放射图半径,放射图平均角度
*
* @author xp
*/
function drawRadial(x0, y0, r, angle){
r = r || 10;
angle = angle || 10;
var len = 360/angle;
var radian = 2*Math.PI*angle/360;
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
for (var i=1; i<=len; i++) {
(function(j){
setTimeout( function timer() {
x1 = x0 + r*Math.cos(radian*j)
y1 = y0 + r*Math.sin(radian*j)
ctx.beginPath();
ctx.moveTo(x0,y0);
ctx.lineTo(x1,y1);
ctx.stroke();
}, j*1000 );
}(i))
}
}