/* Jaclyn Saik
Section E
project 09
*/
var ryder;
function preload(){
var buddy = "https://i.imgur.com/PGxudTG.png"; //my brother eating corn!
ryder = loadImage(buddy); //variable to contain the pixels in image
}
function setup() {
createCanvas(480, 470);
background("goldenrod");
ryder.loadPixels(); //loads actual pizels into program
frameRate(1000);
}
function draw() {
var px = random(width); //randomized variable for x position
var py = random(height);//randomized variable for y position
var ix = constrain(floor(px), 0, width-1); //var for grabbing pixel data
var iy = constrain(floor(py), 0, height-1);
var theColorAtLocationXY = ryder.get(ix, iy);
var rando = random(-30, 30); //variable to randomize stroke weight later
var stro = random(1, 5); //variable to randomize stroke weight later
var stroTwo = random(1, 10);
noStroke();
fill(theColorAtLocationXY); //fills with the color at that particular pizel
stroke(theColorAtLocationXY);
strokeWeight(stro); //randomized stroke weight so stars are unique
drawStar(px, py); //draws star at random x and y position each time draw is called
line(px, py, px+rando, py+rando); //pritns "tails" connected to stars
var theColorAtTheMouse = ryder.get(mouseX, mouseY);
stroke(theColorAtTheMouse);
strokeWeight(stroTwo); //makes a line that changes stroke weight
line(pmouseX, pmouseY, mouseX, mouseY); //draws line with the mouse,
//so you can paint on the canvas a little bit
}
function drawStar(x, y) {
textSize(random(20, 70)); //randomizes size of star
text("*", x, y); //creates object that can be manipulated by position later
}
function mousePressed() { //draws "yum" when mouse is pressed
noStroke();
textSize(random(10, 40)); //alternates size of text
fill("yellow");
text("yum", mouseX, mouseY);
}
For this project, I instantly though of my little brother: he is always posing for funny photos and I especially miss him right now. I chose to use an asterisk to color in his image, since I think it adds a whimsical touch to the image. I added some randomized tails to each asterisk is order to try to create this oil-painting technique where the image looks like it has some motion to it. I also edited the mouse function so that the stroke is randomized each millisecond, so that it appears like your mouse is a brush that is applying varying amounts of paint. Since my brother Ryder is eating corn in this image, when you click your mouse, the word “yum” pops around. It makes him somewhat of a meme, which is how I see him a lot so it makes sense to me.