1/** 2 * Functions. 3 * 4 * The drawTarget() function makes it easy to draw many distinct targets. 5 * Each call to drawTarget() specifies the position, size, and number of 6 * rings for each target. 7 */ 8 9void setup() 10{ 11 size(200, 200); 12 background(51); 13 noStroke(); 14 smooth(); 15 noLoop(); 16} 17 18void draw() 19{ 20 drawTarget(68, 34, 200, 10); 21 drawTarget(152, 16, 100, 3); 22 drawTarget(100, 144, 80, 5); 23} 24 25void drawTarget(int xloc, int yloc, int size, int num) 26{ 27 float grayvalues = 255/num; 28 float steps = size/num; 29 for(int i=0; i<num; i++) { 30 fill(i*grayvalues); 31 ellipse(xloc, yloc, size-i*steps, size-i*steps); 32 } 33} 34