Home  >  Article  >  Web Front-end  >  html5 Canvas draws lines closePath() example code _html5 tutorial skills

html5 Canvas draws lines closePath() example code _html5 tutorial skills

WBOY
WBOYOriginal
2016-05-16 15:51:091500browse

Core code:

Copy code
The code is as follows:

$(function(){
var can = $("#can").get(0);
var txi = can.getContext("2d");
txi.beginPath();
txi.moveTo( 105,105);
txi.lineTo(105,45);
txi.lineTo(45,105);
txi.closePath();
txi.stroke();
txi.beginPath( );
txi.moveTo(25,25);
txi.lineTo(100,25);
txi.lineTo(25,100);
txi.stroke();
})


Copy code
The code is as follows:



closePath(); Close the path
The picture below is one that uses, close, One is useless:

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn