Code in Processing, its javascript variant p5

var any;
var one;
var two;
var landscape;

var space;
var RUN = false;

function preload() {
  any = loadImage("any.png");
  one = loadImage("one.png");
  two = loadImage("two.png");
}

function setup() {
  createCanvas(0.9 * windowWidth, 0.9 * windowHeight);
  ellipseMode(RADIUS);
  noStroke();

  space = new Space();
}

function draw() {
  if (RUN) {
    background(255);
    background(landscape);
    space.grow();
    space.kill();
    space.draw();
  } else {
    background(255);
    fill(87, 132, 137, 100);
    rect(0, height / 3, width / 3, height / 3);
    image(any, 0, height / 3, width / 3, height / 3);
    fill(244, 176, 39, 100);
    rect(width / 3, height / 3, width / 3, height / 3);
    image(one, width / 3, height / 3, width / 3, height / 3);
    fill(220, 77, 11, 100);
    rect(2 * width / 3, height / 3, width / 3, height / 3);
    image(two, 2 * width / 3, height / 3, width / 3, height / 3);
    space = new Space();
  }
}

function mousePressed() {
  if (!RUN) {
    if (mouseY < height / 3) return;
    if (mouseY > 2 * height / 3) return;
  }

  RUN = !RUN;

  if (RUN) {
    landscape = any;
    if (mouseX > width / 3) landscape = one;
    if (mouseX > 2 * width / 3) landscape = two;
    background(landscape);
    space.seed();
  }
}

function Space() {
  this.cells = [];

  this.seed = function() {
    for (var i = 0; i < 30; i++) {
      this.cells.push(new Cell(0.2 * width, 0.8 * height));
    }
  }

  this.grow = function() {
    for (var i = this.cells.length - 1; i >= 0; i--) {
      this.cells[i].mature();
      if (this.cells[i].age > 10) {
        this.cells.push(new Cell(this.cells[i].x, this.cells[i].y));
        this.cells[i].age = 0;
      }
    }
  };

  this.kill = function() {
    var size = log(this.cells.length) / log(10);
    for (var i = this.cells.length - 1; i >= 0; i--) {
      if (!this.cells[i].in && random(10) < 1) {
        this.cells.splice(i, 1);
      } else if (size > random(25)) {
        this.cells.splice(i, 1);
      }
    }
  };

  this.draw = function() {
    for (var i = this.cells.length - 1; i >= 0; i--) {
      this.cells[i].draw();
    }
  };
}

function Cell(parentX, parentY) {
  this.x = parentX + random(-1, 1) * width / 40;
  this.y = parentY + random(-1, 1) * height / 40;
  this.age = 0;

  this.in = true;
  var c = get(this.x, this.y);
  if (255 - red(c) + 255 - green(c) + 255 - blue(c) < 60) {
    this.in = false; // if background is transparent
  }

  this.mature = function() {
    this.age += 3 * random(1 + this.x / width);
  };

  this.draw = function() {
    fill(90, 175, 225, 100);
    if (this.in) fill(0, 90, 155, 100);
    ellipse(this.x, this.y, width / 100, width / 100);
  };
}