Maybe you can advice me, I need to draw with canvas using the coordinates of images as vertex, but I have the images into a table(html table) so I don't know how to do that, how to do the draw inside the table or over the table. For example you have an image on coordinates(60,90) another on (79,45) and other on (70,64), i need to make a triangle with that coordinates, but the images are into a table(each image in different cells. This is my draw code:
function draw(elem) { //elem is the image
var image= elem;
var position = image.getBoundingClientRect();
//alert(posicion.top+" "+ posicion.right+" "+posicion.bottom+" "+posicion.left);
var canvas = document.getElementById('myCanvas');
var contexto = canvas.getContext('2d');
contexto.beginPath();
contexto.moveTo(position.top,50);
contexto.lineTo(position.top,150);
contexto.lineTo(position.top+100,150);
contexto.fill();
}
and this is my canvas:
<canvas id="myCanvas" width="700" height="700">Your browse don't support canvas</canvas>
I put it under the table code and I call the function in other function. If you could help me it would be great. Thanks!