วันอาทิตย์ที่ 30 สิงหาคม พ.ศ. 2558

Lab 2 : Function Music

 
 int posX=0;
 int posY=0;

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

void draw(){
 background(0);
 //int posX=posX+2;
 //int posY=posY+2;

 draw_linkin(posX,posY);
}

void keyPressed(){
  int dx = 5;
  posX = (posX + dx) % width;
 
  int dy = 5;
  posY = (posY + dy) % height;
}

void draw_linkin(int posX,int posY){
  fill(#ffffff);
  ellipse(240+posX,240+posY,450,450);        //inside circle
  fill(#000000);
  ellipse(240+posX,240+posY,400,400);     

  fill(#ffffff);
  triangle(240+posX,70+posY,90+posX,340+posY,390+posX,340+posY);     //triangle
  fill(#000000);
  triangle(240+posX,120+posY,130+posX,320+posY,350+posX,320+posY);   

  strokeWeight(30);                //black line
  stroke(#000000);
  line(260+posX,posY-10,114+posX,260+posY);
  line(287+posX,70+posY,183+posX,260+posY);
  line(295+posX,70+posY,185+posX,260+posY);
  line(200+posX,360+posY,148+posX,450+posY);
  
  stroke(#ffffff);                 //white line                                                   
  line(275+posX,165+posY,138+posX,408+posY);

  strokeWeight(5);                 //outside circle
  noFill();
  ellipse(240+posX,240+posY,470,470);
}

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

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