Robert Oh- Project 09- Portraits


//Robert Oh
//Section C

var Chris;

function preload() {
    var myImageURL = "";
    Chris = loadImage(myImageURL);

function setup() {
    createCanvas(480, 367);

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
    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)


Leave a Reply