rectMode(CENTER); //draw rectangles where x,y is center pointstroke(107,105,105,100); //stroke with transparancyvar rectSize =50; //initial rectangle sizevar sizeMax =100; //max size of a shapevar sizeMin =20; //min size of a shapevar radius = rectSize/2; //radiusvar c1 =color(0,255,187,100); //green w/transparancyvar c2 =color(255,122,5,100); //orange w/transparancybackground(255,255,255); //set white background one timevar draw=function() {var fraction =map( mouseX,0, width,0.0,1.0);var curColor =lerpColor( c1, c2, fraction); //determine color fill(curColor); //create a gradient based on x positionif( mouseX < width/2){ //relax state //size should start large, become small at center rectSize =map( mouseX,0, width/2, sizeMax, sizeMin);//radius should start at max, become 0 at center radius =map( mouseX,0, width/2, sizeMax/2,0); }if( mouseX > width/2){ //stress state//size starts small gets larger at right edge rectSize =map( mouseX, width/2, width, sizeMin, sizeMax);//radius should start at 0 at center, get 'sharper' at right edge radius =map( mouseX, width/2, width,0,-sizeMax/2); }rect( mouseX,mouseY, rectSize, rectSize, radius); //draw the shape};