INTERNET ART: networks, performative programming, and web as context

Bouncing Box

Leave a comment

Screen Shot 2016-09-29 at 10.54.14 AM.png

boolean square = false;
float xx = random(300);
float yy = random(300);
float xx2 = random(300);

float dd = 20;
float speed = random(-2,5);
float speed2 = random(-2,5);
//color aa = #012279;
float xdirection = random (-2, 5);
float ydirection = random (-2, 5);
int xdirection2 = -2;
int ydirection2 = -2;

void setup () {
size (300,300);
background (90);
}

void draw () {
background (90);
//ellipse(xx,yy,dd,dd);
rect (xx,yy,dd,dd);

xx = xx + (speed * xdirection);
yy = yy + (speed2 * ydirection);

if (xx >width-20 || xx < 0) {
xdirection *= -1;
float rr = random(255);
float gg = random(255);
float bb = random(255);
float tt = random(255);
color ran = color(rr,gg,bb,tt);
float xdirection = random (-2, 5);

fill(ran); }
if (yy >height-20 || yy < 0) {
ydirection *= -1;
float rr = random(255);
float gg = random(255);
float bb = random(255);
float tt = random(255);
color ran = color(rr,gg,bb,tt);

float ydirection = random (-2, 5);
fill(ran);
}
}

Leave a Reply

Please log in using one of these methods to post your comment:

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