View SourceCodeaddRectangle NextStep
var canvasDiv="viewport";
var canvasContext;
var canvasObject;
var renderObject;
function addRandomRectangle()
{
posx=Math.floor((Math.random() * 500) + 1);
posy=Math.floor((Math.random() * 500) + 1);
test=new Shape();
test.createRectangle(posx,posy,100,50);
renderObject.addRenderElement(test);
}
Shape.prototype.createRectangle=function(x,y,width,height)
{
this.addMarker(x,y);
this.addMarker(x+width,y);
this.addMarker(x+width,y+height);
this.addMarker(x,y+height);
}