//AirForceRadar //Ethan Davis //This is an interactive drawing of a radar. //The mouse controls dots on the screen (things the radar would pick up and display) //Clicking highlights all targets and displays a warning void setup() { size(400, 400); } void draw() { //made custom cursor that appears later in the code noCursor(); //Click slows framerate, this speeds it up again frameRate(60); //Radar Screen noStroke(); strokeWeight(1); background (60,229,23); fill(1, 35, 0); ellipse(200, 200, 360, 360); fill(1, 50, 0); ellipse(200, 200, 320, 320); fill(1, 65, 0); ellipse(200, 200, 280, 280); fill(1, 80, 0); ellipse(200, 200, 240, 240); fill(1, 95, 0); ellipse(200, 200, 200, 200); fill(1, 110, 0);; ellipse(200, 200, 160, 160); fill(1, 125, 0); ellipse(200, 200, 120, 120); fill(1, 140, 0); ellipse(200, 200, 80, 80); fill(1, 165, 0); ellipse(200, 200, 40, 40); stroke(60,229,23); line(200, 20, 200, 380); line(20, 200, 380, 200); line(330, 70, 250, 150); line(70, 70, 150, 150); line(330, 330, 250, 250); line(70, 330, 150, 250); //Vertical ticks line(190,40,210,40); line(190,80,210,80); line(190,120,210,120); line(190,160,210,160); line(190,240,210,240); line(190,280,210,280); line(190,320,210,320); line(190,360,210,360); //Horizontal ticks line(40,190,40,210); line(80,190,80,210); line(120,190,120,210); line(160,190,160,210); line(240,190,240,210); line(280,190,280,210); line(320,190,320,210); line(360,190,360,210); //Draw thicker lines strokeWeight(4); line(200,0,200,130); line(200,400,200,290); line(0,200,130,200); line(400,200,290,200); //Dots //Dot highlights noStroke(); fill(40,200,16,100); ellipse(200-(cos(mouseY*0.015)*100),200-(cos(mouseX*0.015)*100),25,25); ellipse(100-(sin(mouseY*0.015)*50),100-(sin(mouseX*0.015)*50),35,35); ellipse(350-(sin(mouseY*0.01)*150),200-(-sin(mouseX*0.005)*100),35,35); ellipse(200-(sin(frameCount*0.015)*250),200-(cos(frameCount*0.0150)*100),35,35); //Dot Cores fill(60,229,23); ellipse(200-(cos(mouseY*0.015)*100),200-(cos(mouseX*0.015)*100),15,15); ellipse(100-(sin(mouseY*0.015)*50),100-(sin(mouseX*0.015)*50),25,25); ellipse(350-(sin(mouseY*0.01)*150),200-(-sin(mouseX*0.005)*100),25,25); ellipse(200-(sin(frameCount*0.015)*250),200-(cos(frameCount*0.0150)*100),25,25); //Sensor Line strokeWeight(11); stroke(60,229,23,10); line(200, 200, 200-(cos((frameCount-28)*0.015)*200),200-(sin((frameCount-28)*0.015)*200)); stroke(60,229,23,15); line(200, 200, 200-(cos((frameCount-24)*0.015)*200),200-(sin((frameCount-24)*0.015)*200)); stroke(60,229,23,25); line(200, 200, 200-(cos((frameCount-20)*0.015)*200),200-(sin((frameCount-20)*0.015)*200)); stroke(60,229,23,50); line(200, 200, 200-(cos((frameCount-16)*0.015)*200),200-(sin((frameCount-16)*0.015)*200)); stroke(60,229,23,100); line(200, 200, 200-(cos((frameCount-12)*0.015)*200),200-(sin((frameCount-12)*0.015)*200)); stroke(60,229,23,150); line(200, 200, 200-(cos((frameCount-8)*0.015)*200),200-(sin((frameCount-8)*0.015)*200)); stroke(60,229,23,200); line(200, 200, 200-(cos((frameCount-4)*0.015)*200),200-(sin((frameCount-4)*0.015)*200)); stroke(60,229,23); line(200, 200, 200-(cos(frameCount*0.015)*200),200-(sin(frameCount*0.015)*200)); //Black background to hide lines and dots that go off the radar strokeWeight(135); stroke(25); noFill(); ellipse(200,200,500,500); strokeWeight(3); //Draw custom cursor stroke(60,229,23); fill(60,229,23); quad(mouseX,mouseY,mouseX,mouseY+15,mouseX+4,mouseY+10,mouseX+10,mouseY+10); } void mousePressed() { //slow down frame rate so everying is visable frameRate(3); //draw red boxes around dots rectMode(CENTER); noFill(); stroke(255,0,0); rect(200-(cos(mouseY*0.015)*100),200-(cos(mouseX*0.015)*100),35,35); rect(100-(sin(mouseY*0.015)*50),100-(sin(mouseX*0.015)*50),45,45); rect(350-(sin(mouseY*0.01)*150),200-(-sin(mouseX*0.005)*100),45,45); rect(200-(sin(frameCount*0.015)*250),200-(cos(frameCount*0.0150)*100),45,45); //redraw background so boxes dont pop up on top strokeWeight(135); stroke(25); noFill(); ellipse(200,200,500,500); strokeWeight(3); //WARNING SIGN //box strokeWeight(5); stroke(255,0,0); line(20,340,30,340); line(20,340,20,350); line(50,340,60,340); line(60,340,60,350); line(20,380,30,380); line(20,370,20,380); line(60,380,50,380); line(60,370,60,380); //WARNING //W line(80,340,90,380); line(90,380,100,360); line(100,360,110,380); line(110,380,120,340); //A line(130,380,140,340); line(140,340,150,380); line(135,365,145,365); //R line(160,340,160,380); line(180,340,160,340); line(180,340,180,360); line(180,360,160,360); line(160,360,180,380); //N line(190,340,190,380); line(190,340,210,380); line(210,380,210,340); //I line(220,340,240,340); line(230,340,230,380); line(220,380,240,380); //N line(250,340,250,380); line(250,340,270,380); line(270,380,270,340); //G line(300,340,280,340); line(280,340,280,380); line(280,380,300,380); line(300,380,300,360); line(300,360,290,360); //Draw the ! noStroke(); fill(255,0,0); rect(40,370,7,7); quad(37,360,42,360,45,345,35,345); }