xxxxxxxxxx
let myImage1;
function preload() {
myImage1 = loadImage("https://images.unsplash.com/photo-1604227878600-00157ecb7c74?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=400&q=80")
}
function setup() {
createCanvas(myImage1.width, myImage1.height);
background(100);
}
function draw() {
for (let i = 0; i < 100; i++) {
const x = mouseX + random(-100, 100);
const y = mouseY + random(-100, 100);
const colour = myImage1.get(x, y);
const [r,g,b]= colour
fill(255-r, 255-g, 255-b)// negative image
noStroke();
circle(x, y, random(2, 10));
}
}