adev_Project09_Portrait

 

 

 

Project_09_adev

//Aisha Ghei Dev
//adev@andrew.cmu.edu
//Project-09
//Section E



var myPortrait;

function preload() {//loading baby photo
    var myPortraitURL = "https://i.imgur.com/GszICUU.jpg";
    myPortrait = loadImage(myPortraitURL);
}

function setup() {
    createCanvas(500, 500);
    background(0);
    myPortrait.loadPixels();
    frameRate(10);//low frame rate for faster processing.
    noStroke();
}

function draw() {
	//random position values
	var px = random(width);
    var py = random(height);
    var ix = constrain(floor(px), 0, width-1);
    var iy = constrain(floor(py), 0, height-1);
    //colour at specific pixel
    var theColorAtLocationXY = myPortrait.get(ix, iy);
 
    fill(theColorAtLocationXY);
    var sqDimensions = (random(10, 50));

    rect(px, py, sqDimensions/2, sqDimensions/2);
}

   
//Writing nickname
function mousePressed(){
	fill(255,0,0);
	textFont ("Georgia");
	textSize(28);
	text("$$$PAISHA", mouseX, mouseY);
}



    











    

For this project, I wanted to do something light and fun and kind of poke fun at myself. I chose this baby picture of me that I think is hilarious.

I played around with a few iterations of my code and I liked the one with the text the most because it makes is even more personal with a funny childhood nickname.

Leave a Reply