How to make move able triangle in canvas js
function drawTrianlge(e) { // add this with event listener...
var bx = fe.offsetX;
var by = fe.offsetY;
var x = e.offsetX;
var y = e.offsetY;
var takeLineLen = Math.abs((bx + by) - (x + y));
context.beginPath();
context.moveTo(bx, by);
context.lineTo(x, y);
context.moveTo(x, y);
context.lineTo(takeLineLen - x / 2 , y);
context.moveTo(takeLineLen - x / 2 , y);
context.lineTo(takeLineLen - y / 2 , by);
context.stroke();
context.closePath();
}