xxxxxxxxxx
38
function preload() {
img1 = loadImage("living-1.JPG")
}
function setup() {
count=0;
createCanvas(windowWidth,windowWidth);
noStroke();
let photo = img1;
let x = random(1,2600);
let y = random(1,2600);
let pix = photo.get(x, y);
fill(pix);
background(pix);
image(photo, 0, 0, windowWidth, windowWidth);
}
function draw() {
var x1 = floor(random(width/2));
var y1 = floor(random(height/2));
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));
count=count+1;
if (count>3000) {noLoop()}
}
function keyReleased() {
if (keyCode == ENTER || keyCode == RETURN) {
noLoop();
}
if (keyCode == DELETE || keyCode == BACKSPACE) {
loop();
}
}