/

HTML / CSS / JavaScript Tutorial

JavaScript canvas2d object method: fill()

[this page | pdf | back links]

The fill() method of the JavaScript DOM object returned by the getContext("2d") method applied to the HTML <canvas> element fills the current path. If the path is not closed then this method will add a line from the last point to the start point of the path, like closePath().

 

It has the following syntax with no parameters.

 

context.fill()

 


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


Desktop view | Switch to Mobile