???? ?? ??? ????.
Context? arc ???? ??? ??? ??? ????. arc ???? x ? y ????? ?? ?? ????, radius? ????, startAngle ? endAngle? ?? ?? ??? ? ?????. ??(????? ??), ?? ?? ?? ??? ?? ?? ??(true) ?? ?? ??(false)?? ??? ??? ??? ?????.
??? ??? ????:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>huatu</title> <body> <canvas id="demoCanvas" width="500" height="600"></canvas> <script type="text/javascript"> //通過id獲得當(dāng)前的Canvas對象 var canvasDom = document.getElementById("demoCanvas"); //通過Canvas Dom對象獲取Context的對象 var context = canvasDom.getContext("2d"); context.beginPath();//開始繪制路徑 //繪制以 (60,60)為圓心,50為半徑長度,從0度到360度(PI是180度),最后一個(gè)參數(shù)代表順時(shí)針旋轉(zhuǎn)。 context.arc(60, 60, 50, 0, Math.PI * 2, true); context.lineWidth = 2.0;//線的寬度 context.strokeStyle = "#000";//線的樣式 context.stroke();//繪制空心的,當(dāng)然如果使用fill那就是填充了。 </script> </body> </html>