xxxxxxxxxx
50
let images = [];
const squareSize = 100;
function preload() {
images.push(loadImage('image-7.jpg'));
images.push(loadImage('image-8.jpg'));
images.push(loadImage('image-9.jpg'));
images.push(loadImage('image-10.jpg'));
images.push(loadImage('image-11.jpg'));
images.push(loadImage('image-12.jpg'));
}
function setup() {
createCanvas(600, 600);
imageMode(CENTER);
for (const img of images) {
img.resize(squareSize, squareSize);
}
background(32);
frameRate(10);
}
function draw() {
const x = squareSize / 2 + squareSize * floor(random(width / squareSize));
const y = squareSize / 2 + squareSize * floor(random(height / squareSize));
translate(x, y);
const r = (PI / 2) * random([0, 1, 2, 3]);
rotate(r);
let redColor;
let greenColor;
let blueColor;
do {
redColor = random(255);
greenColor = random(255);
blueColor = random(255);
} while(redColor < 100 && greenColor < 100 && blueColor < 100);
tint(redColor, greenColor, blueColor);
image(random(images), 0, 0);
}