> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://studio.sketchpad.cc/sp/pad/view/ro.cU07QNGJuIN/rev.2193
 * 
 * authors: 
 *   deadlights

 * license (unless otherwise specified): 
 *   creative commons attribution-share alike 3.0 license.
 *   https://creativecommons.org/licenses/by-sa/3.0/ 
 */ 



  int L = 0;

void setup() {
  size(600,800);
  int L = 0;
}

void draw(){
  r=random(1.1,1.5)*100;
  background(175,199,225);
  drawrec(width/2,height,width/2,height-r, L, 3);
  if(L<150) L+=5;
  Noloop();
}


void drawrec(int x1,int y1,int x2, int y2, int L, int n){
    if(L<150) L+=5;
    
    int d = dist(x1,y1,x2,y2);
    if(d<1) return;
    
      int   r0=int(random(9));
      float r1=random(0.45,0.78);
      float r2=random(0.45,0.78);
      float r3=random(0.25,0.27);
      float r4=random(0.25,0.27);
      
      int x3 = x2+ (x2-x1)*r1 + (y2-y1)*r3;
      int y3 = y2+ (x1-x2)*r3 + (y2-y1)*r1;
      int x4 = x2+ (x2-x1)*r2 - (y2-y1)*r4;
      int y4 = y2- (x1-x2)*r4 + (y2-y1)*r2;
      
    if(dist(x1,y1,x2,y2)>5){
    stroke(90-r0+n+L/5,40-r0+L/2,7+r0+L/2);
    strokeWeight(log(d*d*d*d)/3.3);
    }
    else{
         stroke(95-4*r0,200-8*r0,75-3*r0);  
         strokeWeight(log(dist(x1,y1,x2,y2))*6);
         }
    line(x1,y1,x2,y2);   
    drawrec(x2,y2,x3,y3,L,n+4);
    drawrec(x2,y2,x4,y4,L,n+7);
       
}