Skip navigation

I’m still learning Processing so please excuse me if this reeks of tutorial stuff. I did learn a lot and tried to add different visual elements. Here’s a screenshot and code. By the way, the music was “Anyway You Choose to Give It” by The Black Ghosts, remixed by Boy-8-Bit.

Picture 1

int numChars = 26;
color[] colors = new color[numChars];
int keyIndex;
float keyScale;
int rectWidth;

int gx = 15;
int gy = 35;
float leftColor = 0.0;
float rightColor = 0.0;

void setup()
{
size(400, 400);
noStroke();
background(0);
smooth();
keyScale = 400/numChars-1.0;
rectWidth = width/4;
}

void draw()
{
float circles = map(mouseX, 0, 50, 2, 18);
int x = int(random(0, 400));
int y = int(random(0, 400));
if(keyPressed) {
if(key >= ‘A’ && key <= ‘y’) {
if(key <= ‘Y’) {
keyIndex = key-‘A’;
} else {
keyIndex = key-‘a’;
}
fill(millis()%255);
float beginRect = rectWidth/2 + keyIndex*keyScale-rectWidth/2;
rect(beginRect, 0.0, rectWidth, height);
}
if (key == ‘z’) {
setup();
}
}
if (mousePressed) {
ellipse(x, y, circles, circles);
}
}

Advertisements

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

%d bloggers like this: