Week 4 Tut­o­r­i­a­l 6 Random

by Jingyi Tang
  • Show Sketch
/** @peep sketchcode */
 
//Bubbles in the sea
void setup(){
  size(500,500);
  smooth();
  noStroke();
  ellipseMode(CENTER);
  frameRate(1);
}
 
void draw(){
  background(0,76,153);                  //redrawing the bubbles to flow
  for (int x = 40; x < width; x +=40) {
    for (int y = 40; y < height; y +=40) {
      float r1 = random(20,70);
      fill(255,random(90));
      ellipse(x,random(y),r1,r1);
    }
  }
 
  for (int x = 40; x < width; x +=40) {
    for (int y = 500; y > height/2 ; y -= 20) {
      float r1 = random(10,50);
      fill(0,random(90));
      ellipse(random(x),y,r1,r1);
    }
  }
}

Comments

Nobody has said anything yet.