Recitation 6: Animating an Interactive Poster

Recitation:
For the recitation part, I decided to make a hearts. Instead of using ellipses and triangles to make it, I decided to use bezierVertex() to draw my hearts. I think it was easier and less tedious to measure the coordinates out. 

CODE:

int value = 50;

void setup () {
  size(1024, 768);
}
void draw() {
  for (int y = 15; y < height; y= y + value) {
    for (int x = 50; x < width; x= x + value) {
      smooth();
      noStroke();
      fill(random(0, 255), random(0, 255), random(0, 255), 100);
    
      beginShape();
      vertex(x, y);
      bezierVertex(x, y - 20, x + 40, y - 10, x, y + 25);
      vertex(x, y);
      bezierVertex(x, y - 20, x - 40, y - 10, x, y + 25);
      endShape();
      delay(1);
    }
  }
}

Reflection:

I think the code bezierVertex() for me was the most useful thing I have learned so far in the recitation. It is really cool how simple and easy it is to make a shape. In a way I think I have grown to love the random function. It is so fun to make different colors. Furthermore, by adding another number after the three colors in fill, I can control the transparency of it. For my the hearts were changing colors too fast, so I simply added a delay() at the end to slow it down. Overall, in my opinion it was a success.

Homework:

For the IMA poster, I built on-top of what we did in our lecture class. 

CODE:

boolean mouseClicked = false;

void setup(){
  size(1024, 768);
}

void draw(){
  background();
    for (int x1 = 0; x1 < width+ 60; x1 = x1 + 60) {
    for (int y1 = 0; y1 < height + 60; y1 = y1 + 60) {
      smilie(x1, y1, random(1, 8));
  }
  
    }
    
    
   if (mouseClicked == true) {
    textSize(500);
    fill(random(0,255), random(0,255), random(0,255));
    text("IMA", 125, 550);
  }
}

void mouseClicked(){
  mouseClicked = true;
}

void background() {
  for (int i=0; i<height; i++){
    float b = map(i, 0, height, 255, 0);
    stroke(190, 150, b);    
    line(0, i, width, i);
  }
}

void smilie(int x, int y, float eyesize) {
  fill(random(0, 255), random(0, 255), random(0, 255), 150);
  stroke(10);
  ellipse(x, y, 50, 50);
  
  stroke(10);
  ellipse(x - 10, y - 10, eyesize, eyesize);
  ellipse(x + 10, y - 10, eyesize, eyesize);
  
  delay(1);
  
  stroke(10);
  noFill();
  arc(x, y, 35, 35, radians(45), radians(45+90));
  
}

Reflection:

This code for me was definitely a lot more complex. Originally I wanted the gradient to be diagonal, rather than it going just simply up and down. But I heard it was a lot more complex and difficult. So I reverted back to the simple gradient. I use the smilie code in our lecture class and added a few more touches. First I made the color of each smilie face randomized. Also, I made it transparent, so it will in a way blend with the background color. While coding the text, I did run into some problems. It didn’t seem to register whenever I clicked it. So I added a few more codes. In this case a boolean expression and a true/false function. I set my original mouseClicked = false, so whenever I click it, the statement will become true. This will lead to the word that I wrote down to appear. To make it even more colorful, I also made the IMA word change color. 

Conclusion:

I felt that this recitation was very fruitful, I learned boolean, true/false, and bezierVertex functions. With these I felt that I have a better and more deep understanding of Processing. 

 

Leave a Reply

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