/*
Victoria Reiter
Section B
vreiter@andrew.cmu.edu
Project-09-Portrait
*/
var img;
// preoloads photo of my friend Shirley!
function preload() {
var myImgURL = "https://i.imgur.com/n0vEZ2z.png?2";
img = loadImage(myImgURL);
}
function setup() {
createCanvas(480, 480);
angleMode(DEGREES);
background(89, 10, 201);
imageMode(CENTER);
img.loadPixels();
}
function draw() {
// chooses a random x value located near the cursor
var randomX = floor(random(mouseX - 15, mouseX + 15));
// chooses a random y value located near the cursor
var randomY = floor(random(mouseY - 15, mouseY + 15));
// selects the color from a pixel at a random point near the cursor
fill(img.get(randomX, randomY));
// draws a flower at that point
flower(randomX, randomY);
}
// creates flower shape
function flower(x, y) {
push();
noStroke();
translate(x, y);
ellipse(0, 2, 2, 6);
rotate(45);
ellipse(5, 0, 2, 6);
rotate(90);
ellipse(5, 0, 2, 6);
rotate(135);
ellipse(-8, 5, 2, 6);
rotate(180);
ellipse(8, 4, 2, 6);
rotate(225);
ellipse(-6, 11, 2, 6);
rotate(270);
ellipse(-6, -11, 2, 6);
rotate(-45);
ellipse(0, -13, 2, 6);
pop();
}
这个周末我决定了创造我的朋友Shirley的画像。因为她很艺术的,所以我觉得可能是最好的题材。她很优雅的,所以我决定了创造花来代表这个她的性格的方面。她是我在上海留学的时候的语伴,现在在墨尔本,澳大利亚上大学。你好Shirley!!
This week I decided to make a portrait of my friend Shirley. She is very artistic, so I thought she would be the perfect subject for the project. She is very pretty and elegant, so I decided to create flowers to represent this aspect of her personality. She was my language partner when I studied abroad in Shanghai, and now she attends school in Melbourne, Australia. Hi Shirley!!
I added an aspect where you use the mouse to “paint” the flowers on the screen, and thus be able to control how the portrait is revealed. I think this is interesting, because it allows you to decide how you explore the portrait, and makes the process feel a little more intimate. You can also draw with the mouse in the earlier frames and create swirls and shapes on the screen by revealing the colors of the portrait below.