Answers for "How to make move able triangle in canvas js"

0

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();
        }
Posted by: Guest on May-04-2021
0

How to make move able triangle in canvas js

function drawTrianlge(e) {     // add eventlistener!!!
            var bx = fe.offsetX;
            var by = fe.offsetY;
            var x = e.offsetX;
            var y = e.offsetY;
            context.beginPath();
            context.moveTo(bx, y);       
            context.lineTo(x, y);
            context.lineTo(x, by);
            context.closePath();
            context.stroke();            
        }
Posted by: Guest on May-04-2021

Code answers related to "How to make move able triangle in canvas js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language