Project 09 Computational Landscape

sketchDownload="">
let img;
let smallPoint, largePoint;

function preload() {
  img = loadImage('https://pbs.twimg.com/profile_images/640666088271839233/OTKlt5pC_400x400.jpg');
}

function setup() {
  createCanvas(300, 300);
  smallPoint = 4;
  largePoint = 40;
  imageMode(CENTER);
  noStroke();
  background(255);
  img.loadPixels();
  //frameRate(20);
}

function draw() {
  let pointillize = map(mouseX, 0, width, smallPoint, largePoint);
  let x = floor(random(img.width));
  let y = floor(random(img.height));
 
  let xx = x;
  let yy = y;
  let count = 0;
  while (xx <img.width & yy 0 && yy>0) {
        let pix = img.get(xx, yy);
        fill(pix);
        ellipse(xx, yy, pointillize, pointillize);

        count = count +1;
        xx = xx+1;
        yy=yy+1;
    }
}

If you move the mouse around, you can alter how the landscape is being drawn.

Leave a Reply