Project 9: Computational Portrait

sketch

var img;
var diameter;

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

function setup() {
    createCanvas(320, 480);
    image(img, 0, 0, 320, 480);
    background(110);
}

function draw() {
    noStroke();
    x = random(2000);
    y = random(2992);
    c = img.get(x, y);
    fill(c);
    if (x < 1500 & x > 300 && y < 2000 && y > 550) {
        diameter = 10;
    } else {
        diameter = 20;
    }
    circle((x * 0.16), (y * .16), diameter);
}

Leave a Reply