Hello all good people!
I am curious as to how to draw a simple colored line between coordinates x1,y1 to x2,y2.
Best regards,
Bishiba
Edit, solved:
Thanks to Eliaquim for solving this question. The code works on relative terms where x2, y2 are relative to the x1, y1. To correct for this you can use the below functions for x and y respectivly.
Then you change Eliaquim's code to:
Thank you!
I am curious as to how to draw a simple colored line between coordinates x1,y1 to x2,y2.
Best regards,
Bishiba
Edit, solved:
Thanks to Eliaquim for solving this question. The code works on relative terms where x2, y2 are relative to the x1, y1. To correct for this you can use the below functions for x and y respectivly.
JavaScript:
BISH.distX = function(originId, destId) {
return destId.x - originId.x;
}
BISH.distY = function(originId, destId) {
return destId.y - originId.y;
}
Then you change Eliaquim's code to:
JavaScript:
const path = {x1: 300, y1: 300, x2: BISH.distX(originId, destId), y2: BISH.distY(originId, destId)}
Thank you!