วันอาทิตย์ที่ 13 กันยายน พ.ศ. 2558

lab4movie

void setup() {

  size(500, 500);
}
void draw() {
  background(c4);
  int xx=mouseX;
  int yy=mouseY;
  V3(xx, yy);
}
void V3(int x, int y) {
int n=0;
int m=0;
while(n<2){
  //FACE
  noStroke();
  beginShape();
  fill(c1, c3, c4);
  ellipse(x+m, y+10+m, 180, 210);
  fill(c1, c2, c3);
  ellipse(x-50+m, y+10+m, 80, 155);
  ellipse(x+50+m, y+10+m, 80, 155);
  //EYE
  fill(c2, c1, c4);
  ellipse(x-44+m, y-4+m, 85, 65);
  ellipse(x+46+m, y-4+m, 85, 65);
  //Horn
  beginShape();
  fill(c3, c4, c2);
  triangle(x-70+m, y-25+m, x-92+m, y-98+m, x-14+m, y-25+m);
  triangle(x+30+m, y-25+m, x+98+m, y-98+m, x+76+m, y-25+m);
n++;
m+=50;
}
}
float c1;
float c2;
float c3;
float c4;

void keyPressed() {
  if (key=='q') {
    c1=random(0, 255);
    c2=random(0, 255);
    c3=random(0, 255);
    c4=random(0, 255);
  }
}

ไม่มีความคิดเห็น:

แสดงความคิดเห็น