Loading

Canvas arcTo绘制圆弧

arcTo(x1,y1,x2,y2,r);

当前点x0,y0;圆弧与(x0,y0-x1,y1)相切,与(x1,y1-x2,y2)相切;

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>arcTo</title>
</head>

<body>
    <canvas id='myCanvas' width='200' height='100'>
        your browser does not support canvas
    </canvas>
    <script type="text/javascript">
    var c = document.getElementById('myCanvas');
    var cxt = c.getContext('2d');
    cxt.beginPath();
    cxt.moveTo(20, 20);
    cxt.lineTo(70, 20);
    cxt.arcTo(120, 20, 120, 70, 50);
    cxt.lineTo(120, 120);
    cxt.stroke();
    cxt.moveTo(70, 20);
    cxt.lineTo(120, 20);
    cxt.stroke();
    </script>
</body>

</html>

 

posted @ 2015-07-22 08:35  stono  阅读(498)  评论(0编辑  收藏  举报