Recitation 6

Here is the video:

When you press the “a” on the keyboard, the picture will change. And both background and letters will change their color like a rainbow.

Here is the code:

int size=100;

void setup(){
colorMode(HSB,360,100,100);
size(1024,768);
}

void draw(){
for ( int y = 0; y<height; y=y+size) {
for ( int x = 0; x<width; x=x+size) {
fill(#6C0117);
rect (x, y, size, size);
fill(#530171);
triangle(0+x, 100+y, 50+x, 0+y, 100+x, 100+y);
fill(#FABC1E);
triangle(25+x, 100+y, 50+x, 50+y, 75+x, 100+y);
textSize(100);
fill(#FFFFFF);
text(“IMA Fall 22”, 0, 120);
text(“End-Of-Semester Show”,0,240);

}
}
keyPressed();

}
void keyPressed(){
if(key==’a’){
drawBlue();
}
}

void drawBlue(){
background(0);
for ( int y = size/2; y<height; y=y+size) {
for ( int x = size/2; x<width; x=x+size) {
//fill(random(200,240),90,100);
fill((x +frameCount) % 360,200,200);
ellipse (x, y, size, size);
textSize(128);
text(“8th floor”, 40, 120);
//fill(0, 408, 612);
text(“Friday Dec.16th”, 40, 240);
//fill(0, 408, 612, 204);
text(“6pm to 8pm”, 40, 360);
}
}
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *