Recitation 6: Animated Poster

Recitation

void setup(){
  size(1024,768);
  background(255);
  noStroke();
 
  for (int i = 0; i < 768; i += 1) {
    
    fill(i/4,1/3,i/2);
    rect(0,i,1024,1);
    
  }
}

void draw(){
  strokeWeight(10);
  fill(random(255),random(255),random(255));
  circle(random(1024),random(768),random(255));
  delay(1000);
  //background(random(255),random(255),random(255));

}
void mousePressed(){
   circle(float(mouseX),float(mouseY),random(100,300));
}

void mouseReleased() {
  
  textSize(128);
  text("recitation", mouseX, mouseY); 
  fill(0, 408, 612);
  text("rectitation",mouseX, mouseY+40);
  fill(0, 408, 612, 204);
  text("recitation", mouseX, mouseY+40);
}

The video is here. Click it to open. I don't want my personal info going onto YouTube. Nor do I know how to transform mov to mp4 on Mac. 
IMG_2826
void setup(){
  size(1024,768);
  background(255);
  noStroke();
 
  for (int i = 0; i < 768; i += 1) {
    
    fill(i/4,1/3,i/2);
    rect(0,i,1024,1);
    
  }
}
void mousePressed(){
   circle(float(mouseX),float(mouseY),random(100,300));
}

void mouseReleased() {
  
  textSize(128);
  text("recitation", mouseX, mouseY); 
  fill(0, 408, 612);
}
void draw(){
  strokeWeight(10);
  fill(random(255),random(255),random(255));
  circle(float(mouseX),float(mouseY),random(255));
  delay(100);
  //background(random(255),random(255),random(255));

}

Here is an upgraded version of the poster. 
upgraded version
Homework 

int x;
int y;

void setup(){
  size(1024,768);
  background(255);
  noStroke();
  for (int i = 0; i < 768; i += 1) {
    fill(i/2,i/3,i/4);
    rect(0,i,1024,1);
  }
}
void draw(){
  if (mousePressed == true){
    for (int x = 0; x <= 4; x += 1){
      for (int y = 0; y <= 3; y += 1){
        if ((x*256 < mouseX) && ((x+1)*256 > mouseX) && (y*256 < mouseY) && ((x+1)*256 > mouseY)) {
          fill(random(255),random(255),random(255));
          arc(128+x*256,128+y*256,random(100,256),random(100,256),QUARTER_PI,PI + PI);
          fill(random(255),random(255),random(255));
          arc(192+x*256,64+y*256,25,25,0,PI + PI);
        }
      }
    }
  }
  delay(100);
  
}

Task 1
屏幕录制2022-11-08 12.17.12
Task 2
屏幕录制2022-11-08 12.24.04
Task 3
屏幕录制2022-11-08 14.21.12 The code for Task 3 is above. 


I have learnt to draw different ellipses in multiple ways, circles(), ellipse(), and arc(), and I learnt to use them corresponding to different needs. I knew the collective conditions to be used by if. I have learnt how to command mouse to control the output in the exhibiting stage, in which mousePressed, mouseReleased were used and mouseX, mouseY could locate the mouse. I have also learnt to use stroke to adjust edges of patterns while filling colors was a piece of cake.

Leave a Reply

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