• fullscreen
  • draw_target___funtion_HW_9_16_11.pde
  • void setup()
    {
      size(300, 300);
      background(51);
      noStroke();
      smooth();
      noLoop();
    }
    
    void draw()
    {
      drawTarget(100, 100, 100, 10);
      drawTarget(100, 200, 100, 7);
      drawTarget(150, 150, 100, 3);
      drawTarget(200, 100, 100, 2);
      drawTarget(200, 200, 100, 50);
    }
    
    void drawTarget(int xloc, int yloc, int size, int num)
    {
      float grayvalues = 255/num;
      float steps = size/num;
      for (int i=0; i<num; i++) {
        fill(i*grayvalues);
        ellipse(xloc, yloc, size-i*steps, size-i*steps);
      }
    }
    
    

    code

    tweaks (0)

    about this sketch

    This sketch is running as Java applet, exported from Processing.

    license

    advertisement

    Joshua Moody

    Target Function

    Add to Faves Me Likey@!
    You must login/register to add this sketch to your favorites.

    A function that lets you place a target on screen and determine how many circles appear in it.

    You need to login/register to comment.