class Ring{ float x, y; //x-coordinate, y-coordinate// float r, g, b;//ring color// float startDia;//diameter before mouse pressed// float endDia;//diameter after mouse pressed// float initialDia; float initialX; float initialY; // float flagXleft; // float flagXright; // float flagYtop; // float flagYbtm;// Ring(int xpos, int ypos, int colorRed, int colorGreen, int colorBlue, int rest, int click){ x = xpos; y = ypos; r = colorRed; g = colorGreen; b = colorBlue; startDia = rest; endDia = click; initialDia = rest; initialX = xpos; initialY = ypos; } float stiffness = 0.7; float damping = 0.0; float velocity = 1.0; float targetY = y+10 ; void display(){ float force = stiffness * (targetY - startDia); velocity = damping * (velocity + force); startDia += velocity; noFill(); strokeWeight(5); stroke(r, g, b); ellipse(x, y, startDia, startDia); if(mousePressed == true){ startDia = endDia; ellipseMode(RADIUS); } else{ startDia = initialDia; ellipseMode(CENTER); } } }