Random Shapes code

float circleX = 0;
float circleY = 0;
float circleW = 50;
float circleH = 100;
float circleStroke = 255;
float circleFill = 0;
float backgroundColor = 200;
float change = 0.5;
//rectangle
float rectX = 720;
float rectY = 0;
float rectW = 0;
float rectH = 0;
float rectStroke = 255;
float rectFill = 0;
//line
float lineX1 = 200;
float lineY1 = 250;
float lineX2 = 300;
float lineY2 =340;
//triangle
float TX1 = 0;
float TY1 = 50;
float TX2 = 100;
float TY2 = 100;
float TX3 = 0;
float TY3 = 0;

// Your basic setup
void setup() {
size(720,480);
smooth();
}
void draw() {
// Draw the background and the ellipse
background(backgroundColor);
stroke(circleStroke);
fill(circleFill);
ellipse(circleX,circleY,circleW,circleH);
// Change the values of all variables
circleX = circleX + change;
circleY = circleY + change;
circleW = circleW + change;
circleH = circleH + change;
circleStroke = circleStroke + change;
circleFill = circleFill + change;

fill(random (150));
rect(rectX,rectY,rectW,rectH);
rect(rectX-300,rectY+300,rectW,rectH);

rectX = rectX – change;
rectY = rectY + change;
rectW = rectW – change;
rectH = rectH – change;

line(lineX1,lineY1,lineX2,lineY2);

lineX1 = lineX1 + change;
lineY1 = lineY1 – change;
lineX2 = lineX2 + change;
lineY2 = lineY2 – change;

fill(208,2,2);
triangle(TX1,TY1,TX2,TY2,TX3,TY3);
TX1 = TX1 + change;
TY1 = TY1 + change;
TX2 = TX2 + change;
TY2 = TY2 + change;
TX3 = TX3 + change;
TY3 = TY3 + change;

}

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

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