Austin Treu – Project 09

atreu-proj-09

/*Austin Treu
    atreu@andrew.cmu.edu
    Section B
    Project-09*/

var underlyingImage, strtX = 0, strtY =0, iter = 0;

function preload() {
    var myImageURL = "https://i.imgur.com/gJg4CSd.jpg";
    underlyingImage = loadImage(myImageURL);
}

function setup() {
    createCanvas(240, 427);
    background(0);
    underlyingImage.loadPixels();
    frameRate(1000);
}

function draw() {
    var px = random(width);
    var py = random(height);
    var ix = constrain(floor(px), 0, width-1);
    var iy = constrain(floor(py), 0, height-1);
    var theColorAtLocationXY = underlyingImage.get(ix, iy);

    noStroke();
    fill(theColorAtLocationXY);
    ellipse(px, py, 6, 6);
}

I found this picture of my little brother in my files, thought it was an interesting snapshot, so I utilized it in this. It is interesting to watch the image be formed and try to figure out what it is before it is complete.

Final Image:

Original Image:

Leave a Reply