xxxxxxxxxx
41
let files;
let imgs = [];
function preload(){
files=loadStrings("dir.txt"); //wanted to loadJSON, but something
}
function setup() {
files.forEach(f=>{
loadImage('files/'+f,i=>{
imgs.push(i);
console.log(i);
});
});
console.log(imgs);
createCanvas(3840, 2160);
background(0);
}
function draw() {
if(imgs && imgs.length == files.length){
for(let i=0; i<=500;i++){
rndplc(random(imgs));
}
}
}
function rndplc(img){
push();
angleMode(DEGREES);
imageMode(CENTER);
x=random(0, width+img.width);
y=random(0, height+img.height);
rotate(random(360), [x, y]);
//s=random(.8, 1.3);
//image(img, x, y, img.width*s, img.height*s);
s=random(40, 70)
image(img, x, y, s/img.height*img.width, s);
pop();
}