Project 9 Lydia Jin

sketch

//Lydia Jin
//Section D
//jialuj@andrew.cmu.edu
//Project 9

var brother;

function preload() {
	//load picture of my brother
    var myImageURL = "http://i.imgur.com/NrbfIdb.jpg";
    brother = loadImage(myImageURL);
}

function setup() {
	//set up canvas
    createCanvas(500, 500);
    background(0);
    brother.loadPixels();
    //load 100 times in 60 seconds
    frameRate(100);
}

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 = brother.get(ix, iy);

    //draw quads
    noStroke();
    fill(theColorAtLocationXY);
	quad(px-random(10), py-random(10), px-random(10), py-random(10), px+random(10), py, px, py+random(10));

}

I decided to use a photo of my brother taken in hockey uniform. I used quads to present the image to make it more cool since quads are more random than ellipses. A finished portrait looks like the one below:
collin

Leave a Reply