Loading...
Logo
Processing Forum
The scope should be drawn at the location of the mouse pressed until the
mouse is pressed again when the first cope is erased and an updated scope is
drawn at the new location

the scope should grow from diameter = 1 to the
maximum diameter (DIA). This involves increasing the value of the
current diameter each time the scope is drawn. If the mouse is pressed while
the scope is still growing, the scope should now restart centered at the location
of the latest mouse press.

1.the task requires precision, floating-point variables should be used.
2. The background should be black and the color of the scope should be
hexadecimal #14A028.
3. The scope has a diameter of DIA (200)
4. The scope  shoul d have two axes – horizontal and vertical (white)
5. There should be marking on the two axes. The number of such markings
on each axis is N (16 in the sample output) and the length of each marking
is LENGTH (10 pixels in the sample output). These markings MUST be
drawn using a loop.


Replies(4)

This sounds like homework. We're not just going to do it for you.
What do you have so far? Show us your current code!
I lied. Here you go.

Copy code
  1. void m(){p.y=1;p.x=mouseY;p.z=mouseX;}
  2. float DIA=HALF_PI;void t(){background(1+z());
  3. ellipse(p.z,p.x,p.y+=p.y<199?1:0,p.y);translate(p.z,p.x);
  4. stroke(z());}PVector p=new PVector(-666,1,-1600);
  5. void setup(){size(300,300);fill(-p.z/80,-p.z/10,-p.z/40);
  6. smooth();ellipseMode(CENTER);}void draw(){noStroke();t();
  7. for(int z=-4;z>-8;z--){rotate(DIA);line(0,0,p.y/2,0);pushMatrix();
  8. for(int zz=0;zz<8;zz++){translate(p.y/16f,0);line(0,-5,0,5);
  9. }popMatrix();}}void mousePressed(){m();}int z(){return(-1);}
I agree that this appears to be homework so if you present the code from tfguy44 as being your own work then that is an academic offence called plagiarism - so be warned.
Not that you would want to anyway!