We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9d9d34f commit 94e41c9Copy full SHA for 94e41c9
d/04/index.html
@@ -32,6 +32,21 @@
32
ctx.closePath();
33
ctx.stroke();
34
}
35
+ function drawNumbers(){
36
+ var angle = 0,
37
+ nWidth = 0;
38
+ ctx.save();
39
+ ctx.translate(250, 250);
40
+ ctx.font="19px Arial";
41
+ for(var i = 1; i <= 12; i++){
42
+ if(!(i % 3)){
43
+ angle = Math.PI / 6 * (i - 3);
44
+ nWidth = ctx.measureText(i).width;
45
+ ctx.fillText(i, Math.cos(angle) * 150 - nWidth/2, Math.sin(angle) * 150 + nWidth/2);
46
+ }
47
48
+ ctx.restore();
49
50
// 时针刻度
51
function drawHourDegree(){
52
for(var i = 0; i < 12; i++){
@@ -117,6 +132,7 @@
117
132
ctx.clearRect(0, 0, 500, 500);
118
133
now();
119
134
drawBase();
135
+ drawNumbers();
120
136
drawMinDegree();
121
137
drawHourDegree();
122
138
drawHour();
0 commit comments