2012年9月25日 星期二

Week03,HW03

3.1

int count;
void setup(){
  size(600,600);
  background(255,255,255);
}

color cc;

void android(){
  count++;
  if(count%10==0)cc=color(random(255),random(255),random(255));
  fill(cc);
  noStroke();
  ellipse(300, 200, 200, 200);
  fill(255,255,255);
  rect(200, 200, 200, 100);
  ellipse(260, 150, 20, 20);
  ellipse(340, 150, 20, 20);
  fill(cc);
  rect(200, 210, 200, 150);
  ellipse(225, 360, 50, 50);
  ellipse(375,360, 50, 50);
  rect(220, 355, 150, 30);
  ellipse(345,440, 50, 50);
  ellipse(255,440, 50, 50);
  rect(230, 380, 50, 60);
  rect(320, 380, 50, 60);
  ellipse(435,320, 50, 50);
  ellipse(435,230, 50, 50);
  ellipse(165,320, 50, 50);
  ellipse(165,230, 50, 50);
  rect(140, 230, 50, 90);
  rect(410, 230, 50, 90);
  pushMatrix();
    translate(380,70);
    rotate(PI/6);
    rect(0, 0, 10, 60);
  popMatrix();
  pushMatrix();
    translate(220,73);
    rotate(PI*1.85);
    rect(0, 0, 10, 60);
  popMatrix();
  ellipse(224,70, 10, 10);
  ellipse(385,71, 10, 10);
}

void draw(){
  translate(mouseX-150,mouseY-125);
  scale(0.5);
  android();
}



3.2

int count,click=1;
float x=100,y=100;

void setup(){
  size(600,600);
}

color cc;

void android(){
  count++;
  if(count%10==0)cc=color(random(255),random(255),random(255));
  fill(cc);
  noStroke();
  ellipse(300, 200, 200, 200);
  fill(255,255,255);
  rect(200, 200, 200, 100);
  ellipse(260, 150, 20, 20);
  ellipse(340, 150, 20, 20);
  fill(cc);
  rect(200, 210, 200, 150);
  ellipse(225, 360, 50, 50);
  ellipse(375,360, 50, 50);
  rect(220, 355, 150, 30);
  ellipse(345,440, 50, 50);
  ellipse(255,440, 50, 50);
  rect(230, 380, 50, 60);
  rect(320, 380, 50, 60);
  ellipse(435,320, 50, 50);
  ellipse(435,230, 50, 50);
  ellipse(165,320, 50, 50);
  ellipse(165,230, 50, 50);
  rect(140, 230, 50, 90);
  rect(410, 230, 50, 90);
  pushMatrix();
    translate(380,70);
    rotate(PI/6);
    rect(0, 0, 10, 60);
  popMatrix();
  pushMatrix();
    translate(220,73);
    rotate(PI*1.85);
    rect(0, 0, 10, 60);
  popMatrix();
  ellipse(224,70, 10, 10);
  ellipse(385,71, 10, 10);
}

void draw(){
  background(255,255,255);
  pushMatrix();
    translate(x-150,y-125);
    scale(0.5);
    android();
  popMatrix();
    pushMatrix();
    translate(mouseX-150,mouseY-125);
    scale(0.5);
    android();
  popMatrix();
  x=x*0.95 + mouseX*0.05;
  y=y*0.95 + mouseY*0.05;
}
void mousePressed(){
  saveFrame("screenshot"+click+".jpg");
  click++;
}


3.3

1 則留言: