xxxxxxxxxx
26
let img;
let smallPoint, largePoint; // point variables
function preload() {
img = loadImage('gravatar.png'); // this is my gravatar that I use for profiles
}
function setup() {
createCanvas(720, 400);
smallPoint = 4; //size of points
largePoint = 40; //size of large points
imageMode(CENTER); //centres the image loaded in the preload function
noStroke();
background(255);
img.loadPixels();
}
function draw() {
let pointillize = map(mouseX, 0, width, smallPoint, largePoint);
let x = floor(random(img.width));
let y = floor(random(img.height));
let pix = img.get(x, y);
fill(pix, 128);
ellipse(x, y, pointillize, pointillize);
}