Recitation 7

Step 1

float x = 20;
float y = 30;
float stepX = 48;
float stepY = 20;

void setup() {
  size(800, 800);
  background(41,227,216);
}

void draw() {
for(int i=0;i<width;i+=150){
    for (int j=0;j<height;j+=60){
      drawFish(i, j, 4, color(150,183,181));
    }
  }
}

void drawFish(float u, float v, float s, color c) {
  stroke(22,55,106);
  fill(c);
  triangle(u, v, u+20, v+10, u+20, v-10);
  triangle(u+20, v+10, u+20, v-10, u+80, v);
  triangle(u+80, v, u+90, v+6, u+90, v-6);
  fill(255);
  circle(u+13, v-3, s); 
  circle(u-6, v, s*1.4); 
  circle(u-6, v-10, s*1.8); 
  circle(u-6, v-26, s*2.2); 
}

 

 

 

Step 2

Below is my code for recitation 7.
 

  
int count = 10;
float x[] = new float [count];
float y[] = new float [count];
int size [] = new int [count];
float r[] = new float [count];
float g[] = new float [count];
float b[] = new float [count];
color heartColor[] = new color[count];    
float xspeed[] = new float [count];
float yspeed[] = new float [count];
float k;
float f;
float z;
void setup () {
  size(800, 800);
  background(255, 255, 255);
 
}

void draw () {
   for ( int i=0; i < x.length; i++) {
    // set value for position x and y
    x[i] = random (100, width-100);
    y[i] = random (100, height-100);
    // set value for size
    size[i] = round(random( 50, 100));
    r[i] = random(0,255);
    g[i] = random(0,255);
    b[i] = random(0,255);
    heartColor[i] = color(r[i], g[i], b[i]);
    xspeed[i] = random ( 3);
    yspeed[i] = random ( 3);
  }
  k= random (0,255);
f= random (0,255);
z= random (0,255);
  background (k,f,z);
  fill(100, 150, 100);
  for ( int i=0; i < x.length; i++) {
    Heart(x[i], y[i], size[i], heartColor[i]);
   move();
    bounce();
  }
}

void move() {

  for ( int i=0; i < x.length; i++) {
    x[i] += xspeed[i] ;
    y[i]  += yspeed[i] ;
  }
}

void bounce() {

  for ( int i=0; i < x.length; i++) {
    if ( x[i] <= 0 + size[i]/2 || x[i]>= width - size[i]/2 ) {
      xspeed[i] = -xspeed[i];
    }

    if ( y[i] <= 0+ size[i]/2 || y[i]>= height - size[i]/2 ) {
      yspeed[i] = -yspeed[i];
    }
  }
}

void Heart(float _x, float _y, int _size, color _heartColor){
  fill(_heartColor);
  beginShape();
  curveVertex(_x+50, _y+200);
  curveVertex(_x+50, _y+90);
  curveVertex(_x+10, _y+50);
  curveVertex(_x+25, _y+25);
  curveVertex(_x+50, _y+33);
  curveVertex(_x+50, _y+100);
  endShape();
  beginShape();
  curveVertex(_x+50, _y+100);
  curveVertex(_x+50, _y+33);
  curveVertex(_x+75, _y+25);
  curveVertex(_x+90, _y+50);
  curveVertex(_x+50, _y+90);
  curveVertex(_x+50, _y+200);
  endShape();
  
}

Step 2

Q1: In the reading “Art, Interaction and Engagement” by Ernest Edmonds, he identifies four situations in an interactive artwork: ‘Static’, ‘Dynamic-Passive’, ‘Dynamic-Interactive’ and ‘Dynamic-Interactive(Varying)’. From the exercise, you did today which situations do you identify in every part you executed? Explain.
I think that my work, it’s between “Dynamic-passive” and “Dynamic interactive.” “The internal mechanism is specified by the artist and any changes that take place are entirely predictable”(3). My code does not meet this premise that its color and moving direction are not predictable. I use the Random model to change the color of the heart and set the background color as random in the loop to make a shiny result. But for the next level “Dynamic interactive,” the premise of “the human ‘viewer’ has an active role in influencing the changes in the art object.” For my project, the viewer can’t make the change in the art object, after starting the program, it will play automatically.

 

Q2: What is the benefit of using arrays? How might you use arrays in a potential project?

“Arrays can be created to hold any type of data, and each element can be individually assigned and read.” The data for Arrays set up first is flexible, all the elements can be declared by myself. And also in the following code, I can just use the number that I store in the first instead of repeating writing it, to make my code more precise. In my potential project, I might store user data in arrays to make my poster more vivid。

Leave a Reply

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