xxxxxxxxxx
/*-----------------------------
Pick Start Lines
Click on the screen to generate a line of dots up and down and a line of squares across
Created 2-8-17
Renee Cheng
cheng.835
Modified 2-9-17
https://www.openprocessing.org/sketch/405223
-----------------------------*/
void setup()
{
size(1000,1000);
background(0);
}
void draw()
{
if(mousePressed)
{
pickStart();
}
}
//picks starting point for the 2 functions
void pickStart()
{
ellipseUp(mouseX, mouseY);
squareAcross(mouseX, mouseY);
}
//creates a vertical line of ellipses from mouse click
void ellipseUp(float x, float y)
{
stroke(0,0,200);
fill(random(255),random(255),random(255));
int d=25;
for(float i = y; i < 1000; i = i + 30)
{
ellipse(x,i,d,d);
}
for(float j = y; j > 0; j = j - 30)
{
ellipse(x,j,d,d);
}
}
//creates a horizontal line of squares from mouse click
void squareAcross(float x, float y)
{
stroke(0,0,200);
fill(random(255),random(255),random(255));
int s=25;
for(float i = x; i < 1000; i = i + 30)
{
rect(i,y,s,s);
}
for(float j = x; j > 0; j = j - 30)
{
rect(j,y,s,s);
}
}