/* Rachel Lee
Section E
rwlee@gmail.com
Project 09: Custom Pixel*/
var pic;
// preloads image
function preload() {
pic = loadImage("https://i.imgur.com/iuFu4yy.jpg");
}
function setup() {
createCanvas(358, 480);
pic.loadPixels();
background(255);
imageMode(CENTER);
frameRate(100);
}
function draw() {
// randomizes position of pixel appearance
var x = constrain(floor(random(width)), 0, width - 1);
var y = constrain(floor(random(height)), 0, height - 1);
// randomizes arc width and height
var w = random(5, 30);
var h = random(5, 30);
noStroke();
// picks colors from pixel position
var picCol = pic.get(x, y);
fill(picCol);
// draws arcs as 'custom pixel'
arc(x, y, w, h, HALF_PI, PI);
}
I decided to create a custom pixel portrait of my dad for his birthday this weekend. Due to its personal significance, I found this project to be super fun and rewarding, and hope he enjoys the project! I will be doing more of these in the future to try out different options.