//rectangle

float rectH = 100;

float rectW = 100;

//ellipse

float elliH = 100;

float elliW = 100;

//color

float red = 255;

float green = 255;

float blue = 255;

float alpha = 100;

//triangle

float TriX1= 100;

float TriY1= 100;

float TriX2= 100;

float TriY2= 100;

float TriX3= 100;

float TriY3= 100;

void setup() {

size (720, 480);

frameRate (60);

background (4,0,255);

}

void draw() {

noStroke();

fill (red, green, blue,alpha/10);

if (keyPressed) {

if (key == ‘4’) {

rect (mouseX, mouseY, rectH, rectW);

}

} else if (key == ‘5’) {

triangle (TriX1, TriY1, TriX2, TriY2, TriX3, TriY3);

} else if (key == ‘6’) {

ellipse (mouseX, mouseY, elliH, elliW);

}

}

void keyPressed() {

if (key == ‘1’) {

rectH = random(100);

rectW = random(100);

red = random(255);

green = random(255);

blue = random(255);

alpha = random(100);

}

if (key == ‘2’) {

red = random(255);

green = random(255);

blue = random(255);

alpha = random(100);

TriX1= random(100);

TriY1= random(100);

TriX2= random(100);

TriY2= random(100);

TriX3= random(100);

TriY3= random(100);

}

if (key == ‘3’) {

elliH = random(100);

elliW = random(100);

red = random(255);

green = random(255);

blue = random(255);

alpha = random(100);

}

}