Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
///////////////////////////
/*By: David D'Orazio
 Art:Targeting Computer
 Date:9/5/2017
 Move mouse up and down to turn off and on button lights
 move mouse left and right to to center in on the target
 click mouse to fire 
 */
////////////////////////////////////////////////////////////////////////////////////
void setup() {
  size(400, 400);
}
// used to set the size of the page to 400/400
////////////////////////////////////////////////////////////////////////////////////
void draw() {
  ellipseMode(CORNERS);
  rectMode(CORNERS);
  //black background
  fill(22, 22, 19);
  noStroke();
  rect(0, 0, 400, 400);
  ////////////////////////////////////////////////////////////////////////////////////rectangles on each side of the target finder
  //grey rectangle on the left side 
  fill(16, 30, 28); 
  noStroke();
  rect(0, 40, 20, 200);
  //grey rectangle on the right side
  fill(16, 30, 28);//grey rectangle on the right side 
  noStroke();
  rect(380, 200, 400, 360);
  ////////////////////////////////////////////////////////////////////////////////////fill in the target finder screen background
  //inside rectangle of target finder addnd different colour to the background
  fill(35, 31, 12);
  noStroke();
  rect(50, 110, 350, 330);
  ////////////////////////////////////////////////////////////////////////////////////outline of the target finder screen
  //top left outer circle
  fill (16, 30, 28);
  noStroke();
  ellipse(40, 100, 60, 120);
  //top right outer circle
  fill (16, 30, 28);
  noStroke();
  ellipse(340, 100, 360, 120);
  //bottom left outer circle
  fill (16, 30, 28);
  noStroke();
  ellipse(40, 340, 60, 320);
  //bottom right outer circle
  fill (16, 30, 28);
  noStroke();
  ellipse(340, 320, 360, 340);
  //top left inner circle
  stroke (16, 30, 28);
  noFill();
  ellipse(50, 110, 70, 130);
  //bottom left inner circle
  stroke (16, 30, 28);
  noFill();
  ellipse(50, 310, 70, 330);
  //top right inner circle
  stroke (16, 30, 28);
  noFill();
  ellipse(330, 110, 350, 130);
  //bottom right inner circle
  stroke (16, 30, 28);
  noFill();
  ellipse(330, 310, 350, 330);
  //far left outline rectangle straight
  fill(16, 30, 28);
  noStroke();
  rect(40, 110, 50, 330);
  //far right outline rectangle straight
  fill(16, 30, 28);
  noStroke();
  rect(350, 110, 360, 330);
  //top outline rectangle straight
  fill(16, 30, 28);
  noStroke();
  rect(50, 100, 350, 110);
  //bottom outline rectangle straight
  fill(16, 30, 28);
  noStroke();
  rect(50, 330, 350, 340);
  ////////////////////////////////////////////////////////////////////////////////////circles and rectangles to black out the extra circles
  //top left inner circle
  fill (35, 31, 12);
  ellipse(50, 110, 70, 130);
  //bottom left inner circle
  fill (35, 31, 12);
  ellipse(50, 310, 70, 330);
  //top right inner circle
  fill (35, 31, 12);
  ellipse(330, 110, 350, 130);
  //bottom right inner circle
  fill (35, 31, 12);
  ellipse(330, 310, 350, 330);
  //top black rectangle
  fill(35, 31, 12);
  noStroke();
  rect(60, 110, 340, 120);
  //bottom black rectangle
  fill(35, 31, 12);
  noStroke();
  rect(60, 320, 340, 330);
  //left black rectangle
  fill(35, 31, 12);
  noStroke();
  rect(50, 120, 80, 320);
  //right black rectangle
  fill(35, 31, 12);
  noStroke();
  rect(330, 120, 350, 320);
  ////////////////////////////////////////////////////////////////////////////////////Top buttons
  //button up top 1st one left to right 
  fill(202, 191, 192, mouseY+100);
  noStroke();
  rect(60, 50, 90, 80);

  //button up top 2nd one left to right 
  fill(202, 191, 192, mouseY+100);
  noStroke();
  rect(110, 10, 140, 40);

  //button up top 3rd one left to right 
  fill(103, 0, 3, mouseY+100);
  noStroke();
  rect(110, 50, 140, 80);

  //button up top 4th one left to right 
  fill(80, 128, 141, mouseY+100);
  noStroke();
  rect(160, 10, 190, 40);

  //button up top 5th one left to right 
  fill(103, 0, 3, mouseY+100);
  noStroke();
  rect(160, 50, 190, 80);

  //button up top 6th one left to right 
  fill(202, 191, 192, mouseY+100);
  noStroke();
  rect(210, 50, 240, 80);

  //button up top 7th one left to right 
  fill(103, 0, 3, mouseY+100);
  noStroke();
  rect(260, 10, 290, 40);

  //button up top 8th one left to right 
  fill(80, 128, 141, mouseY+100);
  noStroke();
  rect(260, 50, 290, 80);

  //button up top 9th one left to right 
  fill(202, 191, 192, mouseY+100);
  noStroke();
  rect(310, 10, 340, 40);
  ////////////////////////////////////////////////////////////////////////////////////bottom buttons
  //1st bottom button green
  //fill(0, 69, 0);
  fill(0, 69, 0, mouseY+100);
  noStroke();
  rect(60, 350, 80, 370);  
  //2nd buttom button blue
  //fill(0, 12, 117);
  fill(0, 12, 117, mouseY+100);
  noStroke();
  rect(100, 350, 120, 370);  
  //3rd bottom button green
  //fill(0, 69, 0);
  fill(0, 69, 0, mouseY+100);
  noStroke();
  rect(140, 380, 160, 400);  
  //4th bottom button red
  //fill(96, 0, 3);
  fill(96, 0, 3, mouseY+100);
  noStroke();
  rect(180, 350, 200, 370);  
  //5th bottom button yellow
  //fill(180, 124, 4); 
  fill(180, 124, 4, mouseY+100);
  noStroke();
  rect(180, 380, 200, 400);  
  //6th bottom button orange
  //fill(135, 89, 6);
  fill(135, 89, 6, mouseY+100);
  noStroke();
  rect(240, 350, 260, 370);  
  //7th bottom button bit brighter green
  //fill(79, 105, 0);
  fill(79, 105, 0, mouseY+100);
  noStroke();
  rect(240, 380, 260, 400);  
  //8th bottom button red
  //fill(96, 0, 3);
  fill(96, 0, 3, mouseY+100);
  noStroke();
  rect(280, 380, 300, 400);  
  //9th bottom button blue
  //fill(0, 12, 117);
  fill(0, 12, 117, mouseY+100);
  noStroke();
  rect(320, 350, 340, 370);  
  ////////////////////////////////////////////////////////////////////////////////////outLINES (hahahaha because its only lines in the outline)
  // targeting computer yellow part
  //first left line
  stroke(255, 204, 0);
  line (60, 140, 60, 260);
  //right line
  stroke(255, 204, 0);
  line (340, 140, 340, 260);
  //top line
  stroke(255, 204, 0);
  line (80, 120, 320, 120);
  //bottom line
  stroke(255, 204, 0);
  line (80, 280, 320, 280);
  ////////////////////////////////////////////////////////////////////////////////////connecting the corner lines with circles so they look nice and rounded 
  //top left corner
  stroke (255, 204, 0);
  noFill();
  ellipse(60, 120, 100, 160);
  //top right corner
  stroke (255, 204, 0);
  noFill();
  ellipse(340, 120, 300, 160);
  //bottom left corner
  stroke (255, 204, 0);
  noFill();
  ellipse(60, 280, 100, 240);
  //bottom right corner
  stroke (255, 204, 0);
  noFill();
  ellipse(340, 280, 300, 240);
  ////////////////////////////////////////////////////////////////////////////////////rectangles to block out the rest of the excess circle 
  //1st top black rectangle
  fill(35, 31, 12);
  noStroke();
  rect(80, 121, 320, 140);
  //2nd top black rectangle
  fill(35, 31, 12);
  noStroke();
  rect(61, 140, 340, 165);
  //1st bottom black rectangle top-bottom
  fill(35, 31, 12);
  noStroke();
  rect(61, 240, 340, 260);
  //2nd bottom black rectangle top-bottom
  fill(35, 31, 12);
  noStroke();
  rect(80, 260, 320, 280); 
  ////////////////////////////////////////////////////////////////////////////////////interactive targeting computer two red lines

  rectMode (CENTER);
  //first scanner line left side
  noStroke();
  fill(170, 33, 20);
  rect(100+mouseX/4, 200, 5, 160);
  //second scanner line right side
  noStroke();
  fill(170, 33, 20);
  rect(300+(-mouseX/4), 200, 5, 160); 

  ////////////////////////////////////////////////////////////////////////////////////inner lines of targeting computer (STAY ON TARGET)
  rectMode(CORNERS);
  //straight line 1st left side
  stroke(255, 204, 0);
  line (80, 120, 80, 280);
  //straight line 1st right side
  stroke(255, 204, 0);
  line (320, 120, 320, 280);
  //straight line 2nd left side
  stroke(255, 204, 0); 
  line (120, 120, 120, 280);
  //straight line 2nd right side
  stroke(255, 204, 0); 
  line (280, 120, 280, 280);
  //straight line 3rd left side
  stroke(255, 204, 0); 
  line (143, 140, 143, 260);
  //straight line 3rd right side
  stroke(255, 204, 0); 
  line (257, 140, 257, 260);
  //straight line 4th left side
  stroke(255, 204, 0); 
  line (170, 162, 170, 240);
  //straight line 4th right side
  stroke(255, 204, 0); 
  line (230, 162, 230, 240);
  //straight line 5th left side
  stroke(255, 204, 0); 
  line (180, 170, 180, 230);
  //straight line 5th right side
  stroke(255, 204, 0); 
  line (220, 170, 220, 230);
  //straight line center
  stroke(255, 204, 0);
  line (200, 170, 200, 230);
  //horizontal line 1st top-bottom
  stroke(255, 204, 0);
  line (180, 170, 220, 170);
  //horizontal line 2nd top-bottom
  stroke(255, 204, 0); 
  line (180, 200, 220, 200);
  //horizontal line 3rd top-bottom
  stroke(255, 204, 0); 
  line (180, 230, 220, 230);
  //horizontal line 4th top-bottom
  stroke(255, 204, 0); 
  line (170, 240, 230, 240);
  //horizontal line 5th top-bottom
  stroke(255, 204, 0); 
  line (144, 260, 256, 260);
  //circle in centre
  stroke(255, 204, 0);
  noFill();
  ellipse(190, 190, 210, 210);
  ///////////////////////////////////////////////////////////////////////////////diagonals lines of targeting computer
  //1st diagonal line left side top-bottom
  //rectMode(CORNERS);
  stroke(255, 204, 0);
  line (120, 120, 180, 170);
  //2nd diagonal line left side top-bottom
  stroke(255, 204, 0); 
  line (90, 120, 180, 180);
  //3rd diagonal line left side top-bottom
  stroke(255, 204, 0);
  line (60, 150, 180, 190);
  //4th diagonal line left side top-bottom
  stroke(255, 204, 0); 
  line (60, 250, 180, 210);
  //5th diagonal line left side top-bottom
  stroke(255, 204, 0); 
  line (90, 280, 180, 220);
  //6th diagonal line left side top-bottom
  stroke(255, 204, 0); 
  line (120, 280, 180, 230);
  //1st diagonal line right side top-bottom
  stroke(255, 204, 0); 
  line (220, 170, 280, 120);
  //2nd diagonal line right side top-bottom
  stroke(255, 204, 0); 
  line (220, 180, 310, 120);
  //3rd diagonal line right side top-bottom
  stroke(255, 204, 0); 
  line (220, 190, 340, 150);
  //4th diagonal line right side top-bottom
  stroke(255, 204, 0); 
  line (220, 210, 340, 250);
  //5th diagonal line right side top-bottom
  stroke(255, 204, 0); 
  line (220, 220, 310, 280);
  //6th diagonal line right side top-bottom
  stroke(255, 204, 0); 
  line (220, 230, 280, 280);
  ////////////////////////////////////////////////////////////////////////////////////outline of bottom number counter
  //straight line left side
  stroke(255, 204, 0);
  line (120, 300, 120, 330);
  //straight line right side
  stroke(255, 204, 0); 
  line (280, 300, 280, 330);
  //left corner
  stroke (255, 204, 0);
  noFill();
  ellipse(120, 290, 140, 310);
  //right corner
  stroke (255, 204, 0);
  noFill();
  ellipse(260, 290, 280, 310);
  //straight line top
  stroke(255, 204, 0); 
  line (130, 290, 270, 290);
  ////////////////////////////////////////////////////////////////////////////////////black rectangles to block out the extra circle
  //1st top black rectangle
  fill(35, 31, 12);
  noStroke();
  rect(130, 291, 270, 300);
  //2nd black rectangle
  fill(35, 31, 12);
  noStroke();
  rect(121, 300, 280, 315);
  ////////////////////////////////////////////////////////////////////////////////////bottom number counter
  //1st number
  stroke (170, 33, 20);
  noFill();
  ellipse(130, 300, 150, 320);
  //2nd number
  stroke (170, 33, 20);
  noFill();
  ellipse(160, 300, 180, 320);
  //3rd number
  stroke(170, 33, 20); 
  line (200, 300, 200, 320);
  stroke(170, 33, 20); 
  line (195, 305, 200, 300);
  //4th number
  stroke(170, 33, 20); 
  line (220, 320, 230, 300);
  stroke(170, 33, 20);
  line (220, 300, 230, 300);
  //colon top
  stroke(170, 33, 20); 
  line (240, 302, 240, 304);
  //colon bottom
  stroke(170, 33, 20); 
  line (240, 318, 240, 316);
  //5th number
  stroke (170, 33, 20);
  noFill();
  ellipse(250, 300, 270, 320);
  stroke(35, 31, 12);
  line(130, 310, 270, 310);
  stroke(35, 31, 12);
  line(130, 311, 270, 311);
  frameRate(30);
}
////////////////////////////////////////////////////////////////////////////////////mouse click command
void mousePressed()
{
  println("IT'S AWAY!");
  frameRate(1);
  //Top left arrow
  noStroke();
  fill(170, 33, 20);
  triangle(170, 180, 182, 180, 190, 190);
  noStroke();
  triangle(180, 170, 180, 182, 190, 190);
  //Top right arrow
  noStroke();
  triangle(210, 190, 215, 180, 230, 180);
  noStroke();
  triangle(210, 190, 220, 170, 220, 182);
  //Bottom left arrow
  noStroke();
  triangle(190, 210, 170, 220, 182, 220);
  noStroke();
  triangle(180, 218, 180, 230, 190, 210);
  //Bottom right arrow
  noStroke();
  triangle(210, 210, 220, 230, 220, 215);
  noStroke();
  triangle(210, 210, 215, 220, 230, 220);
}