closePath : Returning to starting point on Canvas

Returns to the starting point.

For this triangle two lines are drawn and then by closePath() the pointer has returned to starting point.
With stroke() command the lines are actually drawn.
void gctx.closePath();
closePath() take the pointer to starting point
var my_canvas=$('#my_canvas').get(0)
var gctx = my_canvas.getContext("2d");
var x=20;
var y=20;
gctx.clearRect(0, 0, my_canvas.width,my_canvas.height);
gctx.beginPath()
gctx.lineWidth=3;
gctx.strokeStyle='#af46f5';
gctx.moveTo(x,y);
gctx.lineTo(x+150,y+150);
gctx.lineTo(x+300,y);
gctx.closePath();
gctx.stroke();


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com




    Post your comments , suggestion , error , requirements etc here .




    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2021 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer