CJ Walsh – Project 09

sketch

// CJ Walsh 
// Section D
// cjwalsh@andrew.cmu.edu
// Project 09

var baseI;
// loading the image into my code
function preload() {
    var myImageURL = "https://i.imgur.com/ItvWF6f.jpg";
    baseI = loadImage(myImageURL);
}
function setup() {
	createCanvas(360, 480);
 	background(0);
    baseI.loadPixels();
    frameRate(15); // speed at which the pixels appear
}

function draw() {
	// setting up conditions for pixels to appear
    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 baseColor = baseI.get(ix, iy);
    // drawing ellipses and rectangles to respresent the pixels of the image 
    noStroke();
    fill(baseColor);
    ellipse(px, py, random(0, 15), random(0, 15));
    rect(px, py, random(0, 15), random(0, 15));

}

While this was a pretty simple and straightforward project, it was fun to experiment with the different ways to present the color of the image through other shapes and forms. Ultimately I decided to go with both rectangles and ellipses because I liked the combination of the curved and angular forms in the images by code created. It was interesting to see the image build itself and lead up to looking closer to the base image. Overall, a fun project!

Leave a Reply