Jacky Tian’s Project 09

sketch

//Project-09
//Yinjie Tian
//yinjiet@andrew.cmu.edu
//Section D
var protrait;

function preload() {
    protrait = loadImage("https://i.imgur.com/tOfQhhw.jpg");
}

function setup() {
    createCanvas(400, 450);
    background(0);
    protrait.loadPixels();
    frameRate(100);
}

function draw() { 
    var x = random(width);
    var y = random(height);
    var pix = protrait.get(x, y);

    stroke(pix);
    var lengthmap = constrain(map(15, 0, y, 0, 20), 5, 50);
    var weightmap = constrain(map(3, 0, 10, 0, x), 0.1, 3);

    push();
    strokeWeight(weightmap);
    line(x + random(-10, 10), y + random(-10, 10), x + lengthmap, y + lengthmap);   
    pop();

   
}

I played with random stroke length and weight to create this portrait I chose.

Leave a Reply