xxxxxxxxxx
var option = false;
var prevTime = 0;
function preload() {
img1 = loadImage('monster1.png');
img2 = loadImage('monster2.png');
}
function setup() {
imageMode(CENTER);
createCanvas(windowWidth, windowHeight);
background(100);
}
function draw() {
background('#CCC');
if (millis() - prevTime > 1000) {
option = !option;
prevTime = millis();
}
if (option) {
image(img1, width/2, height/2);
} else {
image(img2, width/2, height/2);
}
}