HTML and CSS Reference
In-Depth Information
Code
Explanation
function Myrectangle(sx,sy,swidth,sheight,
stylestring) {
this.sx = sx;
this.sy = sy;
this.swidth = swidth;
this.sheight = sheight;
this.fillstyle = stylestring;
this.draw = drawrects;
this.moveit = moveball;
}
function drawrects() {
ctx.fillStyle = this.fillstyle;
ctx.fillRect(this.sx,this.sy,
this.swidth,this.sheight);
}
function Picture (sx,sy,swidth,
sheight,filen) {
Header for function to set up Picture object
var imga = new Image();
Create an Image object
imga.src=filen;
Set the file name
this.sx = sx;
Set the sx property
this.sy = sy;
sy
this.img = imga;
Set the img property to imga
this.swidth = swidth;
swidth
Search WWH ::




Custom Search