Roundrect Demo


  // RoundRect Demo - Jim Bumgardner
  
  size(500,500);
  smooth();
  background(255);
  
  for (int i = 0; i < 40; ++i) 
  {
    // Random Stroke Weight
    strokeWeight(random(1,4));
  
    // 50% Transparent Light Fill Color
    fill( random(128,255), random(128,255), random(128,255), 128 );
  
    // 50% Transparent Dark Stroke Color
    stroke( random(0,64), random(0,64), random(0,64), 128 );
  
    // Random corner radius
    float r = random(8,32);
  
    // Random dimensions and positioning
    float w = random(64,300);
    float h = random(64,300);
    float x = random(2, width-(w+2));
    float y = random(2, height-(h+2));
  
    // Draw a roundrect
    rect(x,y,w,h, r,r,r,r);
  }