Christine Seo – Project 09

sketch

//Christine Seo
//Section C
//mseo1@andrew.cmu.edu
//Project 9

var sisterImg;

function preload() {
	//loading the picture
    sisterImg = loadImage("Sister.png");
}

function setup() {
	//set up canvas
    createCanvas(480, 480);
    background(0);
    sisterImg.loadPixels();
    //load 200 times in a minute
    frameRate(200);
}

function draw() {
    var px = random(width);
    var py = random(height);
    var cx = constrain(floor(px), 0, width-1); //constraining the placement of pixels
    var cy = constrain(floor(py), 0, height-1);
    var colorAtLocationXY = sisterImg.get(cx, cy);

    //draw traingles
    noStroke();
    fill(colorAtLocationXY);
		triangle(px-random(20), py-random(20), px-random(20), py-random(20), px+random(20), py+random(20));

}

Potential Final Image
Original image of my sister

I created an abstract portrait of my sister holding flowers.  I wanted to use randomly sized triangles to represent the pixels. I was quite happy with the result as it made the portrait quite abstract but you could still tell what the picture is to a certain degree.

 

Leave a Reply