首页 > 代码库 > Canvas半圆

Canvas半圆

<!DOCTYPE html><html> <head>    <meta charset="utf-8">    <title>Canvas</title> </head> <style type="text/css"> </style> <script type="text/javascript">    function $$(id){        return document.getElementById(id);    }    function pageLoad(){        var can = $$(can);        var cans = can.getContext(2d);        var jindu = 2;        cans.beginPath();        cans.arc(60,60,50,0,jindu*Math.PI,false);        cans.strokeStyle = #00aae8;        cans.lineWidth = 15;        cans.stroke();        cans.closePath();    } </script><body onload="pageLoad();">    <div style="position: relative;">        <canvas id="can" width="120px" height="60px"></canvas>        <div style="position: absolute;top: 32px;left: 41px;font-size: 21px;font-family: ‘微软雅黑‘;">50%</div>    </div></body></html>

 

Canvas半圆