xxxxxxxxxx
let sources = [
"cola.woman.png",
"dancing.png",
"atari.png",
"kaset.png",
"plak.png",
"computer.png",
"car.png",
"telephone.png",
"cocktails.png" ,
"arrow.png" ,
"balloon.png" ,
"heart.png" ,
"oneway.png" ,
"ahh.png" ,
"flower.png" ,
"hand.png" ,
"woman.reading.png" ,
"building.png" ,
"car2.png" ,
"polaroid.png" ,
];
let imgs = [];
let imgID = 0;
function preload() {
for (let i = 0; i < sources.length; i++) {
imgs[i] = loadImage(sources[i]);
}
}
function setup() {
createCanvas(800, 800);
background(255,239,213);
noLoop();
imageMode(CENTER);
angleMode(DEGREES);
}
function draw() {
background(255,239,213);
// Loop through the images array
for (let i = 0; i < sources.length; i++) {
//random coordinates like a photo collage
let a = 800 / 2 + random(-130, 130);
let b = 800 / 2 + random(-120, 120);
push();
translate(a,b);
scale(0.6,0.6);
rotate(random(360));
//for color
let color1 = random(0,162); //greenish
let color2 = random(79,104); //blue
let color3 = random(94,139);
tint(color1, color2, color3,random(255)); //random for opacity
let modes = [
BLEND,
ADD,
DARKEST,
LIGHTEST,
DIFFERENCE,
EXCLUSION,
MULTIPLY,
SCREEN,
REPLACE,
OVERLAY,
HARD_LIGHT,
SOFT_LIGHT,
DODGE,
BURN,
];
blendMode(random(modes));
// Display the image at translated-rotated position
image(imgs[i], 0, 0);
pop();
}
}
function keyPressed() {
if (key == 'r') {
draw();
}
if (key == 'e') {
save("export.jpg");
}
}