สิงหาคม 30, 2558

Lab2_clock

void draw(){
  int posX=width/2;
  int posY=height/2;
  float s;
  float m;
  float h;
  size(220,220);
  background(30);
  //clock
  strokeWeight(2);
  fill(#22ED48); //colorGreen
  ellipse(posX,posY,200,200);
  fill(255);
  ellipse(posX,posY,180,180);
  fill(0);
  ellipse(posX,posY-75,10,10);
  ellipse(posX+75,posY,10,10);
  ellipse(posX,posY+75,10,10);
  ellipse(posX-75,posY,10,10);
  //pin
  s=radians(second()*6);
  m=radians(minute()*6);
  h=radians(hour()*30);
  strokeWeight(1);
  line(posX,posY,posX+(70*sin(s)),posY-(70*cos(s)));
  strokeWeight(2);
  line(posX,posY,posX+(50*sin(m)),posY-(50*cos(m)));
  strokeWeight(4);
  line(posX,posY,posX+(25*sin(h)),posY-(24*cos(h)));
}

 
errors: Missing right parenthesis ")"
cause: เกิดจากการใส่วงเล็บปิดไม่ครบ
how to fix: เติมวงเล็บเพิ่มให้ครบจำนวน

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

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