The rect function

The rect function is used whilst drawing paths to the canvas to draw a rectangle to the canvas. Nothing is actually drawn to the canvas until you call the stroke or fill functions.

Arguments to the function

An example

    window.onload = function ()
        var canvas  = document.getElementById("cvs");
        var context = canvas.getContext('2d');

        context.rect(50, 50, 100, 100);