Project-09-Chickoff-Self Portrait

sketch

//Cora Hickoff
//Section D
//chickoff@andrew.cmu.edu
//Project-09  

var underlyingImage;
var nPoints = 100;
var CYCLOID = 0; 

var titles = ["-●●●-"];
var curveMode = CYCLOID;

function preload() {

    var myImageURL = "https://i.imgur.com/cNsCKtz.png";
    underlyingImage = loadImage(myImageURL);
}

function setup() {

    createCanvas(480, 480);
    background(100, 170, 25, 100);

    underlyingImage.loadPixels();
    frameRate(100);

    var myImageURL2 = "https://i.imgur.com/Sna9w4t.png";
    img = loadImage(myImageURL2)
    
}

function draw() {

    textSize(23);
    fill(0, 200, 0);
    text("Eat healthy, ya picky eater!", 10, 30);

    textSize(23);
    fill(0, 200, 0);
    text("These edamame beans will make you strong", 10, 400);

    //photo of edamame beans 
    image(img, 0, height/4, width/2);

    //draws the picture
    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 theColorAtLocationXY = underlyingImage.get(ix, iy);

        noStroke();
        fill(theColorAtLocationXY);
        //little pie slices
        arc(px, py, 17, 17, 0, HALF_PI);
    
        //little edamame beans
        //controlled by mouse
        fill(78, 215, 0, 25); 
        text(titles[curveMode], mouseX, mouseY);
        //having this below means the 
        //beans will have no no stroke
        stroke(0);
}

function drawEdamameBeans (thisX, thisY) {

    fill(theColorAtLocationXY);
    titles(titles[curveMode], py, thisX, thisY);
}

My goal with this project was to focus on having fun and being playful with code versus feeling defeated by it. I started with a photo of me from freshman year eating my typical meal, broccoli (which I never ate because it was undercooked) and mac and cheese. That year was not very healthy for me food wise, and so I wanted to make fun of myself being a picky eater in this project, though I have improved a lot.

I decided to have arcs make up the photo because they looked like slices of pie, and then wrote code so that whenever the mouse was dragged a shape would be drawn. I chose “-●●●-“ to be the shape because it looks like edamame beans, which I found I enjoy eating. Plus they’re healthy. Now, by moving these around on the screen, I essentially am “feeding myself” if an edamame bean is moved towards my mouth!

Me and food

Leave a Reply