var prova = document.getElementById("prova2"); let provaBez = prova.getBoundingClientRect(); var prova2 = document.getElementById("prova"); let provaBez2 = prova2.getBoundingClientRect(); let x1 = provaBez.left; let y1 = provaBez.top; let x2 = provaBez2.left; let y2 = provaBez2.top; console.log(x1,y1, 200, 100, x2, y2) var c = document.getElementById("myCanvas"); var ctx = c.getContext("2d"); ctx.canvas.width = window.innerWidth; ctx.canvas.height = window.innerHeight; ctx.beginPath(); ctx.bezierCurveTo(x1,y1, 200, 100, x2, y2); ctx.stroke();