html5-canvas arcTo(路径命令)
示例
context.arcTo(pointX1, pointY1, pointX2, pointY2, radius);
绘制具有给定半径的圆弧。圆弧在当前笔位置所形成的楔形内顺时针绘制,并给出两个点:Point1和Point2。
在圆弧之前会自动绘制一条连接当前笔位置和圆弧起点的线。
<!doctype html>
<html>
<head>
<style>
body{ background-color:white; }
#canvas{border:1px solid red; }
</style>
<script>
window.onload=(function(){
//获取对canvas元素及其上下文的引用
var canvas=document.getElementById("canvas");
var ctx=canvas.getContext("2d");
//论点
var pointX0=25;
var pointY0=80;
var pointX1=75;
var pointY1=0;
var pointX2=125;
var pointY2=80;
var radius=25;
// A circular arc drawn using the "arcTo" command. The line is automatically drawn.
ctx.beginPath();
ctx.moveTo(pointX0,pointY0);
ctx.arcTo(pointX1, pointY1, pointX2, pointY2, radius);
ctx.stroke();
}); //结束window.onload
</script>
</head>
<body>
<canvas id="canvas" width=200 height=150></canvas>
</body>
</html>
热门推荐
10 企业国庆问候祝福语简短
11 老公生日祝福语简短好看
12 古风中考祝福语简短
13 睡觉祝福语女生文案简短
14 香薰的寓意祝福语简短
15 经典新婚祝福语英文简短
16 考试祝福语简短给对象
17 旅行前祝福语简短英语
18 车位销售祝福语简短精辟