Sean Leo – project 09 – Portrait

sleo-project-09

//Sean B. Leo
//Sleo@andrew.cmu.edu
//Section C

//Project 09 Portrait

function preload() {
    var myImageURL = "https://static.wixstatic.com/media/b109e8_9226598d042f4ca2b17fd70a4e0d7319~mv2.jpg/v1/fill/w_572,h_680,al_c,q_85,usm_0.66_1.00_0.01/b109e8_9226598d042f4ca2b17fd70a4e0d7319~mv2.webp"; 
  
    IMG = loadImage(myImageURL);

}

function setup() {
    createCanvas(480, 480);
    background(0);
    IMG.loadPixels();
    frameRate(60);
  imageMode(CENTER);
}

function draw() {
    var px = random(width);
    var py = random(height);
    var ix = constrain(floor(px), 0, width-1);
  //print (ix);
    var iy = constrain(floor(py), 0, height-1);
  //print(iy);
    var rx = px + random(0,10); // randomize x-value
    var ry = py + random(0,10); // randomize y-value
    var rs = random(1,10); // randomize stroke weight
    var theColorAtLocationXY = IMG.get(ix, iy);

    strokeWeight(rs);
    stroke(theColorAtLocationXY);
    line(px,py,rx,ry);
}

Starting
Mid-render
Original Photo