HTML5 Canvas Rectangle Tutorial

To create a rectangle using HTML5 Canvas, we can use the rect() method rather than constructing the shape with 4 connecting lines.  An HTML5 Canvas rectangle is positioned with x and y parameters, and is sized with width and height parameters.  The rectangle is positioned about its top left corner.

new window

Code Editor

Modified on April 8th, 2013 by Eric Rowell
comments powered by Disqus