分针的旋转角度不对
function drawHour(hour){
ctx.save();
ctx.beginPath();
ctx.lineWidth = '5';
//设置线条末端为圆形
ctx.lineCap = 'round';
//每小时弧度 2*Math.PI/12 ==>Math.PI/6
var radHour = hour * Math.PI/6;
//旋转
ctx.rotate(radHour);
ctx.moveTo(0,0);
ctx.lineTo(0,-radius/2);
ctx.stroke();
ctx.restore();
}
function drawMinute(minute){
ctx.save();
ctx.beginPath();
ctx.lineWidth = '3' ;
var radMinute = minute * Math.PI/30;
ctx.rotate(radMinute);
ctx.moveTo(0,0);
ctx.lineTo(60,0);
ctx.stroke();
ctx.restore();
}
drawBackground();
drawHour(6);
drawMinute(30);
指向6点45分,这样看的话drawMinute的旋转是以3点为起始值得