1 | initial version |
To create a canvas shape using two points, an angle, and a distance, you can use the following steps:
x2 = x1 + distance * cos(angle) y2 = y1 + distance * sin(angle)
context.beginPath(); context.moveTo(x1, y1); context.lineTo(x2, y2);
context.closePath();
context.fill(); or context.stroke();