xxxxxxxxxx
32
let imgs = [];
let curImg = 0;
function preload() {
for (let i=1; i < 4; i++) {
let fn = 'asset/horse' + i + '.jpg';
console.log(fn);
let img = loadImage(fn);
imgs.push(img);
}
}
function setup() {
createCanvas(400, 400);
noCursor();
}
function draw() {
background(220);
curImg = floor((mouseX / 10) % 3);
imageMode(CENTER);
tint(255, 0, 0);
image(imgs[curImg], mouseX, mouseY);
/*
curImg = curImg + 1;
if (curImg == 3) {
curImg = 0;
}*/
}