/*Katrina Hu
15104-C
kfh@andrew.cmu.edu
Project-09*/
var originalImage;
function preload() {
var myImageURL = "https://i.imgur.com/g3iK76T.jpg";
originalImage = loadImage(myImageURL);
}
function setup() {
createCanvas(480, 480);
background(0);
originalImage.loadPixels();
frameRate(500);
}
function draw() {
//defining the variables
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 = originalImage.get(ix, iy);
//drawing the random dashes
strokeWeight(4);
stroke(theColorAtLocationXY);
line(px + random(-10, 10), py + random(-10, 10), px + random(-10, 10), py + random(-10, 10));
//drawing the random ellipses
fill(theColorAtLocationXY);
ellipse(px, py, random(1, 8), random(1, 8));
}
I chose to make a portrait of my friend Chelsea. It was fun to experiment with the random sizes and positions of my ellipses and lines.