Handle[] handles; int num=2; float centrex, centrey; void setup() { size(500, 500); centrex = width/2; centrey = height/2; handles = new Handle[2]; int hsize = 10; for(int i=0; i<2; i++) { handles[i] = new Handle(50, height-i*15-30, width-100, 10, handles); } handles[0].length=100; handles[1].length=50; } void draw() { background(255); float spacing=handles[1].length+10; float radius =handles[0].length+4; float x,y; float vSpace = 0.86602540378*spacing; float cornerToCorner = sqrt(width * width + height * height); noFill(); y=centrey; float startx; int even=9999; do { y -= vSpace; even++; } while (y>-radius); float starty=y; int row=0; do { y-=vSpace; even++; } while (y>starty); strokeWeight(1); //for (y=starty; y -radius); startx=x; for (x=startx; x0 && x0 && y0 && x0 && y sqrt(pow(abs(centrex-x),2)+pow(abs(centrey-y),2))) && !(radius > sqrt(pow(abs(centrex-x),2)+pow(abs(centrey-y),2)) + cornerToCorner / 2) ) ) { ellipse(x,y,radius,radius); } } } // draw background to sliders fill(255,255,255,180); noStroke(); rect(50,height-62.5, width-100,12.5); rect(50,height-50, width-100, 25); rect(50,height-25, width-100,12.5); rect(37.5,height-50, 12.5,25); rect(width-50,height-50, 12.5,25); // the 0.5s are necessary to avoid a visible edge by centring the arc on a pixel edge rather than the centre arc(49.5,height-50.5,25,25,PI,1.5*PI); arc(49.5,height-25.5,25,25,0.5*PI,PI); arc(width-50.5,height-50.5,25,25,PI*1.5,2*PI); arc(width-50.5,height-25.5,25,25,0,0.5*PI); strokeWeight(3); stroke(0); for(int i=0; i= x && mouseX <= x+width && mouseY >= y && mouseY <= y+height) { return true; } else { return false; } } int lock(int val, int minv, int maxv) { return min(max(val, minv), maxv); }