p5((s) => {
let sourceImage;
let targetImage;
s.preload = function () {
sourceImage = s.loadImage(imageURL);
};
s.setup = function () {
s.createCanvas(width, height);
sourceImage.resize(width, height);
targetImage = s.createImage(width, height)
s.noFill();
};
s.draw = function () {
let source = [380, 150, 100, 100]
let target = [s.mouseX, s.mouseY, 100, 100]
targetImage.copy(sourceImage, 0, 0, width, height, 0, 0, width, height);
targetImage.copy(sourceImage, ...source, ...target);
s.image(targetImage, 0, 0);
s.stroke("red");
s.rect(...source);
s.stroke("green");
s.rect(...target);
};
})