xxxxxxxxxx
let myImage1;
let myImage2;
function preload() {
myImage1 = loadImage("https://images.unsplash.com/photo-1604227878600-00157ecb7c74?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=800&q=80")
myImage2 = loadImage("https://images.unsplash.com/photo-1605646840343-87ea1843fcbc?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=774&q=80")
}
function setup() {
createCanvas(myImage1.width, myImage1.height);
background(100);
}
function draw() {
if (mouseX < windowWidth / 2) {
for (let i = 0; i < 100; i++) {
const x = random(-100, 100);
const y = random(-100, 100);
fill(myImage1.get(mouseX + x, mouseY + y));
noStroke();
circle(mouseX + x, mouseY + y, random(2, 10));
}} else {
for (let i = 0; i < 100; i++) {
const x = random(-100, 100);
const y = random(-100, 100);
fill(myImage2.get(mouseX + x, mouseY + y));
noStroke();
circle(mouseX + x, mouseY + y, random(2, 10));
}
}
}