วันพฤหัสบดีที่ 4 กันยายน พ.ศ. 2557

Quadrant



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

void draw () {
  background (51, 0, 102);
  stroke (255, 51, 102);
  strokeWeight (5);
  line (0, height/2, width, height/2);
  line (width/2, 0, width/2, height);
  if (mouseX >= width/2  && mouseY <= height/2) {
    text ("Quadrant 1", (width/2)+20, (height/2)-50);
  }
  if (mouseX <= width/2  && mouseY <= height/2) {
    text ("Quadrant 2", 20, (height/2)-50);
  }
  if (mouseX <= width/2  && mouseY >= height/2) {
    text ("Quadrant 3", 20, (height/2)+50);
  }
  if (mouseX >= width/2  && mouseY >= height/2) {
    text ("Quadrant 4", (width/2)+20, (height/2)+50);
  }
}

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

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