let n = 100;
let bg;
let nC = 10;
function preload() {
bg = loadImage("/assets/genuaryalbum.jpeg");
}
function setup() {
cnv = createCanvas(500, 500);
background(255);
noLoop();
noStroke();
}
function draw() {
f = floor(random(0, 5.99));
pxC = bg.get(
bg.width / (width / random(width)),
bg.height / (height / random(height))
);
console.log(pxC);
background(pxC);
for (let i = 0; i < int(random(3, 7)); i++) {
sampleColor(1.4 - 0.2 * i);
}
}
function sampleColor(r) {
for (let i = 1; i < nC; i++) {
pxC = bg.get(
bg.width / (width / random(width)),
bg.height / (height / random(height))
);
console.log(pxC);
fill(pxC);
if (f === 0) {
circle((width / nC) * i, (height / nC) * i, (r * width) / nC);
}
if (f === 1) {
g = random(10, 20);
circle(0, 0, width - i * g);
circle(width, height, width - i * g);
}
if (f === 2) {
circle(width / 2, height / 2, width - i * 40);
}
if (f === 3) {
circle(width / 2, 0, width * 1.1 - (i - 1) * 50);
circle(width / 2, height, width * 1.1 - (i - 1) * 50);
}
if (f === 4) {
g = random(10, 20);
circle(width, 0, width * 1.5 - i * g);
circle(0, height, width * 1.5 - i * g);
}
if (f === 5) {
circle(width / 2, height / 2, width - i * random(5, 100));
}
}
}
function mousePressed() {
setup();
draw();
}