const canvas = document.getElementById('myCanvas');
const ctx = canvas.getContext('2d');
function drawCurvedArrow(ctx, fromX, fromY, toX, toY, controlX, controlY, text) {
ctx.beginPath();
ctx.moveTo(fromX, fromY);
ctx.quadraticCurveTo(controlX, controlY, toX, toY);
ctx.stroke();
const headlen = 10;
const angle = Math.atan2(toY - controlY, toX - controlX);
ctx.beginPath();
ctx.moveTo(toX, toY);
ctx.lineTo(toX - headlen * Math.cos(angle - Math.PI / 6), toY - headlen * Math.sin(angle - Math.PI / 6));
ctx.moveTo(toX, toY);
ctx.lineTo(toX - headlen * Math.cos(angle + Math.PI / 6), toY - headlen * Math.sin(angle + Math.PI / 6));
ctx.stroke();
const midX = (fromX + toX) / 2;
const midY = (fromY + toY) / 2;
ctx.font = '16px Arial';
ctx.fillText(text, midX, midY);
}
drawCurvedArrow(ctx, 50, 150, 200, 150, 125, 50, 'Curved Arrow');