//Robert Oh
//Section C
//rhoh@andrew.cmu.edu
//Project-09-Portrait
var Chris;
function preload() {
var myImageURL = "https://i.imgur.com/0FU7jf7.jpg?1";
Chris = loadImage(myImageURL);
}
function setup() {
createCanvas(480, 367);
background(0);
Chris.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 col = Chris.get(ix, iy);
//randomly creating the X length and thickness
var len = random(2, 7);
var thick = random(1, 5);
//creating the X's
stroke(col);
strokeWeight(thick);
line(px - len, py - len, px + len, py + len);
line(px - len, py + len, px + len, py - len);
}
For this project, I used a photo of my friend, Chris. I thought the X’s were a nice touch and I liked how I generated the X’s using randomness (in both the length and the thickness.
This is a photo of the early stage:
This is the final product:
(The original photo was of my friend sitting on a colorful staircase)