ကြားချိုး စာရင်း
တတိယ အစိတ် - ဘလာစက် အမှတ် ဖော်ပြခြင်း
ဘလာစက် ကို ဖော်ပြရန် လိုလား အစားထိုးပြီး ဘလာစက် အမှတ် ကို ဖော်ပြရန် လိုလား လိုဘာ့ လိုဘာ့ အစားထိုးပြီး ဘလာစက် အမှတ် ကို ဖော်ပြရန်
JavaScript:
function drawClock() { drawFace(ctx, radius); drawNumbers(ctx, radius); } function drawNumbers(ctx, radius) { ctx.font = radius * 0.15 + "px arial"; ctx.textBaseline = "middle"; ctx.textAlign = "center"; for(let num = 1; num < 13; num++){ let ang = num * Math.PI / 6; ctx.rotate(ang); ctx.translate(0, -radius * 0.85); ctx.rotate(-ang); ctx.fillText(num.toString(), 0, 0); ctx.rotate(ang); ctx.translate(0, radius * 0.85); ctx.rotate(-ang); } }
စကားလုံး အရာများ
ပုံစံဖော်ပြ အရေးယူပုံ ကို ကြားနှစ် ၁၅% ထိ ဖော်ပြရန်
ctx.font = radius * 0.15 + "px arial";
ပုံစံဖော်ပြ အရေးယူပုံ ကို ပုံစံဖော်ပြ အခြေခံ နှင့် အရှည်ချင်း အား ဖော်ပြရန်
ctx.textBaseline = "middle"; ctx.textAlign = "center";
ပုံစံဖော်ပြချက် (နှစ်ယောက် အမှတ်) ကို ကြားနှစ် ၈၅% ထိ တွင် ဖော်ပြရန် နှင့် အမှတ် ကို (ပုံစံဖော်ပြ ၆) အား လှည့်ခြင်း
for(num = 1; num < 13; num++) { ang = num * Math.PI / 6; ctx.rotate(ang); ctx.translate(0, -radius * 0.85); ctx.rotate(-ang); ctx.fillText(num.toString(), 0, 0); ctx.rotate(ang); ctx.translate(0, radius * 0.85); ctx.rotate(-ang); }