// Justin Yook
// jyook@andrew.cmu.edu
// Section C
// Project 09
var underlyingImg;
function preload() {
var imgURL = "https://i.imgur.com/25HDnhA.jpg";
underlyingImg = loadImage(imgURL);
}
function setup() {
createCanvas(270, 480);
background(255);
underlyingImg.loadPixels();
frameRate(60);
}
function draw() {
var x = random(width);
var y = random(height);
var px = constrain(floor(x), 0, width-1);
var py = constrain(floor(y), 0, height-1);
var theColorAtLocationXY = underlyingImg.get(px, py);
noStroke();
fill(theColorAtLocationXY);
rect(x, y, 20, 10);
}
For the portrait, I used my friend’s face. I kept playing around with the style of points being drawn, but I decided on a long rectangle because it reminded me of actual old paintings; in addition, the slight obscurity of his face made it look less boring. I also set the frame-rate to be higher so it paints the portrait faster.