Hi,
I’ve created this working code in processing and would like to implement it on a website - I am completely new to this, so I am not sure whether or not it is possible to convert this to p5.js with just a few changes? Or if there’s another way around it?
Thanks a lot in advance!
/ Mikkel
PImage img;
int i = 1;
float x0, y0;
function setup() {
size(800, 800);
img = loadImage("image01.png");
imageMode(CENTER);
background(0);
x0 = -200;
y0 = -200;
}
function draw() {
if (mouseX != 0 && mouseY != 0) {
image(img, x0, y0);
img = loadImage("image"+i+".png");
if (dist(mouseX, mouseY, x0, y0) > 100) {
img = loadImage("image"+i+".png");
i++;
if (i == 20) {
i = 1;
}
x0 = mouseX;
y0 = mouseY;
}
}
}