Project 9 – Portrait

What is Beauty?

sketch – Copy – Copy – Copy
// Ana Furtado 
// Section E
// Project 9 Computational Portrait
//What is Beauty?

let img;
let smallPoint;
let largePoint; 

function preload() {
    //img = loadImage('https://i.imgur.com/pl5VSHB.jpeg')
    img = loadImage('https://i.imgur.com/hxAyzbU.jpeg')
}

function setup() {
    createCanvas(480, 480);
    smallPoint = 10;
    largePoint = 15;
    img.resize(width, height);
    imageMode(CENTER);
    background(255);
    noStroke(); 
    img.loadPixels();
    frameRate(75);
}


function draw() {
    //paint the image using dots
    let point = map(mouseX, 0, width, smallPoint, largePoint);
    let x = floor(random(img.width));
    let y = floor(random(img.height));
    let pix= img.get(x,y);
    fill(pix, 128);
    //fill(pix);
    ellipse(x, y, point, point);

    //prints What is Beauty? across canvas in random places using image colors
    wordtext = ["What", "is", "Beauty?"];
    for (var i = 0; i <3; i++) {
        fill(pix);
        textSize(random(1,15));
        text(wordtext[floor(random(wordtext.length))], random(0,width), random(0,height));
        //floor gives less messages than round
    }

    //paints/ further distorts image using randomly placed line of image color 
    push();
    stroke(pix);
    let a = random(0,width);
    let b = random(0,height);
    line(a, b, a+10, b+10);
    //line(a, b+10, a+10, b);
    pop();
}

    
    

The most challenging part of this project was making all the different elements work to distort the existing image to create a new portrait.

Leave a Reply