Color Shifting

Continue reading “Color Shifting”

Advertisements

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)”

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;
}

Moving Shapes

Here is the code of an assignment for Interactive Authoring that deals with moving shapes, both interactive and non-interactive.

boolean click;
boolean button;
float r;
float g;
float b;
float a;
float circleX;
float circleY;
float circleW = 0;
float circleH = 0;
float rectX;
float rectY;
float rectW;
float rectH;
float triX1;
float triX2;
float triY1;
float triY2;

void setup(){

size(720,480);
smooth();

}

void draw(){

background(0,g,b);
frameRate(24);

r = random(255);
g = random(255);
b = random(255);
a = (100);
circleX = 360;
circleY = 240;
rectX = random(width);
rectY = random(height);
rectW = random(200);
rectH = random(200);
triX1 = 720;
triY1 = 480;
triX2 = 0;
triY2 = 480;

//rectangle
noStroke();
fill(r,0,b);
rect(rectX,rectY,rectW,rectH);

//triangles
fill(0,113);
triangle(0,0,0,480,triX1,triY1);
fill(255,113);
triangle(720,0,720,480,triX2,triY2);

//circle
noStroke();
fill(r,g,b);
ellipse(mouseX,mouseY,circleW,circleH);

if (click == true){

circleW = circleW + 2;
circleH = circleH + 2;

}

//black screen with text
if (button == true){
frameRate(2);
noStroke();
fill(0);
rect(0,0,720,480);
textSize(50);
fill(r,g,b);
text(“error”,596,473);
}

}

void mousePressed(){
click = true;
}

void keyPressed(){
button = true;
}

void keyReleased(){
button = false;
}