html5教程調(diào)用繪圖api畫(huà)簡(jiǎn)單的圓形代碼分享

字號(hào):


    html5畫(huà)簡(jiǎn)單的圓形代碼分享,大家參考使用吧
    代碼如下:
    <!DOCTYPE html><head>
    <meta charset=utf-8>
    <title>HTML5畫(huà)圓形</title>
    <script src="<a ></script</a>>
    </head>
    <script>
    $(document).ready(function(){
    var c=document.getElementById("drawbox");
    var draw=c.getContext("2d"); //獲取2d內(nèi)容的引用,調(diào)用繪圖API</p> <p>draw.fillStyle="red"; //顏色
    draw.beginPath(); //從新畫(huà)
    draw.arc(50,50,50,0,Math.PI*2,true); //圓心x坐標(biāo)|圓心y坐標(biāo)|直徑|始|PI為圓周率,Math.PI*2為畫(huà)圓|true為時(shí)針?lè)较颍耗鏁r(shí)針,0為順時(shí)針,
    draw.closePath(); //結(jié)束
    draw.fill();
    })
    </script>
    </body>
    <canvas id="drawbox" width="500" height="500"></canvas>
    </body>
    </html>
    名單