2021-06-10 20:39:09 +08:00
|
|
|
export default function arcTo(ctx) {
|
2015-06-13 17:06:25 -07:00
|
|
|
ctx.beginPath();
|
|
|
|
ctx.moveTo(150, 20);
|
2023-03-09 17:15:52 -08:00
|
|
|
ctx.arcTo(150, 100, 250, 20, 20);
|
|
|
|
ctx.stroke();
|
|
|
|
|
|
|
|
ctx.beginPath();
|
|
|
|
ctx.arc(450, 100, 20, 180/180*Math.PI, 45/180*Math.PI, true);
|
2015-06-13 17:06:25 -07:00
|
|
|
ctx.stroke();
|
|
|
|
|
|
|
|
ctx.fillStyle = 'blue';
|
|
|
|
// base point
|
2023-03-09 17:15:52 -08:00
|
|
|
ctx.fillRect(150, 20, 2, 2);
|
2015-06-13 17:06:25 -07:00
|
|
|
|
|
|
|
ctx.fillStyle = 'red';
|
|
|
|
// control point one
|
2023-03-09 17:15:52 -08:00
|
|
|
ctx.fillRect(150, 100, 2, 2);
|
2015-06-13 17:06:25 -07:00
|
|
|
// control point two
|
2023-03-09 17:15:52 -08:00
|
|
|
ctx.fillRect(250, 20, 2, 2);
|
|
|
|
|
|
|
|
ctx.beginPath();
|
|
|
|
ctx.moveTo(150, 200);
|
|
|
|
ctx.arcTo(250, 200, 250, 250, 20);
|
|
|
|
ctx.stroke();
|
|
|
|
|
|
|
|
ctx.beginPath();
|
|
|
|
ctx.moveTo(150, 400);
|
|
|
|
ctx.arcTo(50, 400, 20, 450, 20);
|
|
|
|
ctx.stroke();
|
2015-06-13 17:06:25 -07:00
|
|
|
};
|