Visual Music (Butthole Surfers – 22 Going on 23)

This was created in Processing.  A musical keyboard is used to show the images and sounds throughout the song. Continue reading “Visual Music (Butthole Surfers – 22 Going on 23)”

Advertisements

Animation Code

int counter;
float pupilW;
float pupilH;
float r;
float g;
float b;
float mouthX;
float mouthY;

void setup() {
size(300, 400);
smooth();
counter++;
}
void draw() {

counter = counter + 1;

r = random(255);
g = random(255);
b = random(255);

background(0,g,b);

//head
stroke(0);
fill(255);
ellipse(width/2, height/2, 200, 300);
ellipse(100, 180, 40, 40); // left eye
ellipse(186, 180, 40, 40); // right eye

fill(r,g,b);
ellipse(100, 180, pupilW, pupilH); // left pupil
ellipse(186, 180, pupilW, pupilH); // right pupil

if (pupilW < 40){
pupilW = pupilW + .5;
pupilH = pupilH + .5;
}
if (pupilW == 40){
pupilW = 0;
pupilH = 0;
}

fill(255);
ellipse(143, 280, mouthX, mouthY); // mouth
//shroom
noStroke();
fill(144,90,90);
rect(mouseX-5,mouseY,10,30);
fill(r,0,b);
arc(mouseX,mouseY,40,40,PI,TWO_PI);
if (counter==1){
mouthX = 0;
mouthY = 0;
} else if (counter>1 && counter<100 && mouthX<=50 && mouthY<=50){
mouthX = mouthX + .5;
mouthY = mouthY + .5;
} else if (counter>100 && counter<150 && mouthX>=10 && mouthY>=10){
mouthX = mouthX – 1;
mouthY = mouthY – 1;
} else if (counter>200 && counter<250 && mouthX<=50 && mouthY<=30){
mouthX = mouthX + 1;
mouthY = mouthY + .5;
} else if (counter>250 && counter<300){
mouthX = mouthX – .5;
mouthY = mouthY – .5;
}
}
void mousePressed(){
counter = 0;
}