Week6



I re-uploaded my assignment after making a this new one. 
This shows the changes in my height divided by the ages of 10, 15 and present.





code:

float[]my_height = new float[3];
PImage khj;
PImage img_me;

void setup() {
  size (1000, 800);

  my_height[0] = 145;
  my_height[1] = 160;
  my_height[2] = 163;
  
  img_me = loadImage("khj.png");
}

void draw()
{
  background(255,255,255);
  
  strokeWeight(3);
  strokeCap(ROUND);
  stroke(0);
  fill(30,150,150);
  rect(900, 0, 20, 800);
  
  for(int i=0; i<3; i++) {
    if (mouseX>10+300*i && mouseX<300+300*i) {
        image( img_me, 30+300*i, 800-10*(my_height[i]-120));
        
        fill(30,150,150);
        strokeWeight(3);
        strokeCap(ROUND);
        stroke(0);
        line(900,800-10*(my_height[i]-120), 915, 800-10*(my_height[i]-120));
        
        strokeWeight(3);
        strokeCap(ROUND);
        stroke(0);
        fill(30,150,150);
        rect(820,810-10*(my_height[i]-120),150,70); 
        
        fill(255,255,255);
        textSize(30); 
        text( my_height[i], 810,870-10*(my_height[i]-120));
    }
  }
  
  fill(0,100,255);
  PFont font;
  font = createFont("SFCompactRounded-Semibold.otf",26);
  textFont(font);
  text("2007(10)",30,70);
  text("2012(15)",330,70);
  text("2019(22)",630,70);
  
  fill(100,100,200);
  font = createFont("SFCompactRounded-Semibold.otf",10);
  textFont(font);
  text("My height change: 10~22 years old", 40, 200, 400, 300);
}




+ This is my first work, but Its quite raw and random. 



code:
float[] rx = new float[100];
float[] ry = new float[100]; 
float[] side = new float[500];
     
 void setup() {
    size(500,500);
    background(0);
 }
 
 void draw() {
   size(500,500);
   background(0);
   strokeWeight(2);
   stroke(255);
   
   int c=color(random(255), random(255), random(255));
   fill(c);
   
   for ( int i=0; i< 50; i=i+5) {
    rx[i] = random(0,500); 
    ry[i] = random(0,500);
    side[i] = random(0,40);
    
    square (rx[i], ry[i], side[i]); 
  }
}

  





덧글

댓글 입력 영역