function drawHour(hour,minute){
ctx.save();
ctx.beginPath();
var rad = 2 * Math.PI / 12 * hour;
var mrad = 2 * Math.PI / 12 /60 * minute;
ctx.rotate(rad + mrad);
ctx.lineWidth = 6;
ctx.lineCap = 'round';
ctx.moveTo(0,10);
ctx.lineTo(0,-r/2);
ctx.stroke();
ctx.restore();
}
function drawMinute(minute){
ctx.save();
ctx.beginPath();
var rad = rad = 2*Math.PI/60 * minute;
ctx.rotate(rad);
ctx.lineWidth = 3;
ctx.lineCap = 'round';
ctx.moveTo(0,10);
ctx.lineTo(0,-r + 10);
ctx.stroke();
ctx.restore();
}
drawBackground();
drawHour(4);
drawMinute(30);
drawHour(4);改为drawHour(4,30);
rad=hour/6*Math.PI = = 一圈360°是2π 分为12份 那么6份就是π 小时数除于6 表示有几份π