xxxxxxxxxx
98
function preload() {
img1 = loadImage('photo-1.jpg');
img2 = loadImage('photo-2.jpg');
img3 = loadImage('photo-3.jpg');
img4 = loadImage('photo-4.jpg');
img6 = loadImage('photo-6.jpg');
img7 = loadImage('photo-7.jpg');
img8 = loadImage('photo-8.jpg');
img9 = loadImage('photo-9.jpg');
img10 = loadImage('photo-10.jpg');
img11 = loadImage('photo-11.jpg');
img12 = loadImage('photo-12.jpg');
img13 = loadImage('photo-13.jpg');
img14 = loadImage('photo-14.jpg');
img15 = loadImage('photo-15.jpg');
img16 = loadImage('photo-16.jpg');
img17 = loadImage('photo-17.jpg');
img18 = loadImage('photo-18.jpg');
img19 = loadImage('photo-19.jpg');
img20 = loadImage('photo-20.jpg');
img21 = loadImage('photo-21.jpg');
img22 = loadImage('photo-22.jpg');
img23 = loadImage('photo-23.jpg');
img24 = loadImage('photo-24.jpg');
img25 = loadImage('photo-25.jpg');
img26 = loadImage('photo-26.jpg');
img27 = loadImage('photo-27.jpg');
img28 = loadImage('photo-28.jpg');
img29 = loadImage('photo-29.jpg');
img30 = loadImage('photo-30.jpg');
img31 = loadImage('photo-31.jpg');
img32 = loadImage('photo-32.jpg');
img33 = loadImage('photo-33.jpg');
img34 = loadImage('photo-34.jpg');
img35 = loadImage('photo-35.jpg');
img36 = loadImage('photo-36.jpg');
img37 = loadImage('photo-37.jpg');
img38 = loadImage('photo-38.jpg');
img39 = loadImage('photo-39.jpg');
img40 = loadImage('photo-40.jpg');
}
function setup() {
createCanvas(700, 700);
//background(240);
noStroke();
let photos = [img1, img2, img3, img4, img6, img7, img8, img9, img10,img11, img12, img13, img14, img15, img16, img17, img18, img19, img20,img21, img22, img23, img24, img25, img26, img27, img28, img29, img30,img31, img32, img33, img34, img35, img36, img37, img38, img39, img40];
let photo1 = random(photos);
let xp1 = random(width);
let yp1 = random(height);
let xp2 = random(width);
let yp2 = random(height);
let pix1 = photo1.get(xp1, yp1);
let pix2 = photo1.get(xp2, yp2);
let s = random(300,700);
fill(pix1);
rect(random(width-s), random(height-s), s);
fill(pix2);
rect(random(width-s), random(height-s), s);
image(photo1, random(width-s), random(height-s),s,s);
}
function draw() {
var x1 = floor(random(width));
var y1 = floor(random(height));
var x2 = round(x1 + random(-4, 4));
var y2 = round(y1 + random(-4, 4));
var w = width/2;
var h = height/2;
set(x2, y2, get(x1, y1, w, h));
}
function keyReleased() {
if (keyCode == ENTER || keyCode == RETURN) {
fill(0,5)
rect(0,0,700)
noLoop();
}
if (keyCode == DELETE || keyCode == BACKSPACE) {
loop();
}
}