Recursively Generated Clouds – Continued

Continuing on from the clouds I had generated earlier, I thought it would be pretty cool if I could get it to move and appear to grow.

Unfortunately, I haven’t been able to make it do that yet. I have however, gotten it to generate random cloud combinations and position them randomly on the canvas with semi-random colours based around reds, yellows and oranges.

It is available online here.

I have added a stroke(1) command to the draw function, every time it redraws the clouds, it will add a stroke around each circle, this gives it a very cartoony look. I have commented this out as it slows down the rendering, but switching it back on is very easy by removing the //.

Changing the value of the level has a significant impact on the render times, increasing it slows it down, decreasing it speeds u the render. On my computer, 5 seems to be ideal, anything higher and the interval between each cloud that is generated becomes uneven. Anything lower and the density of the clouds starts to drop and it loses some of the effect.

void setup() 
  size(500, 500);

void draw() 
  // uncommenting the below creates a very cartoony effect
  // stroke(1);
  drawCircle(random(500), random(500), random(170), 5);

void drawCircle(float x, float y, float radius, float level) 
  float r = 126 * level/4.0;
  float g = random(80);
  float b = random(60);
  fill(r, g, b);
  ellipse(x, y, radius*2, radius*2);      
  if(level > 1) {
    level = level - 0.5;
    int num = int(random(2, 6));
    for(int i=0; i<num; i++) {
      float a = random(0, TWO_PI);
      float nx = x + sin(a) * 6.0 * level;
      float ny = y + radius/2;
      drawCircle(nx, ny, radius/2, level);

Tags: , , ,

Leave a Reply