/

HTML / CSS / JavaScript Tutorial

JavaScript canvas2d object method: stroke()

[this page | pdf | back links]

The stroke() method of the JavaScript DOM object returned by the getContext("2d") method applied to the HTML <canvas> element draws a path in the canvas. The default colour is black, but this can be overridden using the strokeStyle property.

 

It has the following syntax with no parameters.

 

context.stroke()

 


NAVIGATION LINKS
Contents | Prev | Next | JavaScript DOM (and BOM)


Desktop view | Switch to Mobile