let img;
//my name is an array of letters
let name = ['a', 'l', 'i', 'c', 'e'];
//load image
function preload() {
image = loadImage('http://i.imgur.com/S0F2kRi.jpg');
}
function setup() {
createCanvas(720, 400);
imageMode(CENTER);
noStroke();
background(255);
image.loadPixels();
}
function draw() {
let px = floor(random(image.width));
let py = floor(random(image.height));
let pix = image.get(px, py);
fill(pix, 128);
textSize(20);
textFont("Impact");
//call random letter from name array
text(random(name), py, px);
}
Here is my “pointillism” self-portrait. I wanted to change the points to the letters of my name, so I created an array and called random letters from that array. The letters are called at random coordinates.