Julie Choi – Project 09 – Portrait

julie and alice

/*Julie Choi
15-104 Section E
jjchoi@andrew.cmu.edu
Project-09
*/
var underlyingImage;

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

function setup() {
    createCanvas(700, 700);
    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);
    var ballSize = map(mouseX, 0, width, 4, 20);

    stroke(theColorAtLocationXY);
    strokeWeight(2);
    line(px + random(10), py + random(10), px + random(30), py + random(30));

    push();
    rotate(random(0, PI));
    noStroke();
    fill(theColorAtLocationXY);
    quad(px + random(30), py + random(30), px-random(30), py-random(30), px+random(30), py+random(30), px - random(30), py - random(30));
    pop();
}

I had a lot of fun doing this project because I had the chance to use my personal photo as a visual element of the project. I chose a photo of me and my friend that we took during the sunset of an afternoon.

Original Image
Result after few minutes

Leave a Reply