xxxxxxxxxx
52
let img = [];
let doodleImage = 0;
let showImage = false
let randomImage = false
let h = 1920;
let w = 1080;
let scaleFactor = 0.8;
function preload() {
img[0] = loadImage('images/0.jpg');
img[1] = loadImage('images/1.jpg');
img[2] = loadImage('images/2.jpg');
img[3] = loadImage('images/3.jpg');
img[4] = loadImage('images/4.jpg');
img[5] = loadImage('images/5.jpg');
img[6] = loadImage('images/6.jpg');
img[7] = loadImage('images/7.jpg');
img[8] = loadImage('images/8.jpg');
img[9] = loadImage('images/9.jpg');
}
function setup() {
createCanvas(windowWidth, windowHeight);
frameRate(5);
background(255, 255, 255);
}
function draw() {
textSize(60);
imageMode(CENTER)
image(img[doodleImage], width / 2, height / 2, w * scaleFactor, h * scaleFactor);
text(doodleImage, width / 2, 100);
if (randomImage) {
doodleImage = int(random(1, 9));
}
if (showImage) {
doodleImage = int(random(1, 9));
}
}
function touchStarted() {
randomImage = !randomImage
}
function keyPressed() {
showImage = !showImage
}