You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
594 B
JavaScript

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();