Processing Experiments

screen-shot-2016-09-29-at-2-14-40-pm

This image was created in Processing 2.0. The image consists of many lines that were created out of a couple of loops in the code. The video below demonstrates the interactive aspect of this image.

float X;
float Y;
float diam;
float r;
float g;
float b;
float a;

void setup(){
size(1100,700);
background(0);
}

void draw(){
stroke(255);
strokeWeight(3);
smooth();

for (int i = 0; i < 70; i ++) {
for (int k = 0; k < 70; k ++){
stroke(30,144,255);
strokeWeight(1.5);
line(i*20,k*20,width/2,height/2);

stroke(255);
rotate(0.2);
line(i*20,k*20,width/2,height/2);
}
}
for (int i = 0; i < 70; i ++) {
for (int k = 0; k < 70; k ++){
stroke(255,2);
rotate(0.2);
strokeWeight(1.5);
line(i*20,k*20,mouseX,mouseY);
}
}

if (keyPressed){
if (key == ‘q’){
X = random(width/2);
Y = random(height/1.25);
diam = random(100);
a = random(100,50);
stroke(0,0,b,a);
fill(0,0,b,a);
ellipse(X,Y,diam,diam);
}
}
}

void mouseDragged(){
if (mousePressed){
stroke(255);
strokeWeight(3);
line(pmouseX,pmouseY,0,0);
stroke(30,144,255);
strokeWeight(3);
line(pmouseX,pmouseY,width,height);

stroke(255);
strokeWeight(3);
line(pmouseX,pmouseY,0,height);
stroke(30,144,255);
strokeWeight(3);
line(pmouseX,pmouseY,width,0);
}
}

Advertisements
This entry was posted in Interactive, Time Based and tagged , . 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