ICM Sept 26

function setup() {
createCanvas(800, 650);
}

function draw() {
background(0);
drawLamp(100, 100, 550);
drawLamp(250, 100, 550);
drawLamp(400, 100, 550);
drawLamp(550, 100, 550);
}
function drawLamp(x, y, baseY) { //parameters
var shadewidth = 100;
stroke(30);
rect(x + 40, y + 50, 20, 400); //tube
rect(x, y, 100, 100); //shade
rect(x + 25, baseY, 50, 50); //base
this.update = function() { //when the mouse is inside the lampshade the background goes to yellow
if (mouseX > x && mouseX < (x + shadewidth) && mouseY > y && mouseY < y + shadewidth) {
rect(10, 10, 10, 10);

}

}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s