let widthC = 0; let heightC = 0; let canvas; let canvasX; let canvasY; const unplugButton= document.getElementById('unplugButton'); const body= document.body; const texto= document.getElementById('texto'); let fr = 12;

const download = (filename)=>{ let link = document.createElement('a'); link.download = `${filename}.png`; link.href = document.getElementById('defaultCanvas0').toDataURL() link.click(); }

const randomNumber = ()=>{ return Math.random() * 1000; }

function setup() { canvas = createCanvas(1920, 1080); frameRate(fr); }

function draw() { background(getRandomArbitrary(0,255),getRandomArbitrary(0,255),getRandomArbitrary(0,255)); noStroke(); fill(getRandomArbitrary(0,255),getRandomArbitrary(0,255),getRandomArbitrary(0,255)); triangle(Math.round(getRandomArbitrary(0,1920)), Math.round(getRandomArbitrary(0,1080)), Math.round(getRandomArbitrary(0,1920)), Math.round(getRandomArbitrary(0,1080)), Math.round(getRandomArbitrary(0,1920)), Math.round(getRandomArbitrary(0,1080))); fill(getRandomArbitrary(0,255),getRandomArbitrary(0,255),getRandomArbitrary(0,255)); rect(getRandomArbitrary(0,1920), getRandomArbitrary(0,1080), getRandomArbitrary(0,1920), getRandomArbitrary(0,1080)); fill(getRandomArbitrary(0,255),getRandomArbitrary(0,255),getRandomArbitrary(0,255)); quad(getRandomArbitrary(0,1080), getRandomArbitrary(0,1920), getRandomArbitrary(0,1080), getRandomArbitrary(0,1920), getRandomArbitrary(0,1080), getRandomArbitrary(0,1920), getRandomArbitrary(0,1080), getRandomArbitrary(0,1920)); fill(getRandomArbitrary(0,255),getRandomArbitrary(0,255),getRandomArbitrary(0,255)); ellipse(Math.round(getRandomArbitrary(0,1920)), Math.round(getRandomArbitrary(0,1080)), Math.round(getRandomArbitrary(0,1920)), Math.round(getRandomArbitrary(0,1080))); fill(getRandomArbitrary(0,255),getRandomArbitrary(0,255),getRandomArbitrary(0,255)); triangle(getRandomArbitrary(0,1920), getRandomArbitrary(0,1920), getRandomArbitrary(0,1920), getRandomArbitrary(0,1920), getRandomArbitrary(0,1920), getRandomArbitrary(0,1920)); fill(getRandomArbitrary(0,255),getRandomArbitrary(0,255),getRandomArbitrary(0,255)); arc(Math.round(getRandomArbitrary(0,1080)), Math.round(getRandomArbitrary(0,1080)), Math.round(getRandomArbitrary(0,1080)), Math.round(getRandomArbitrary(0,1080)), PI, TWO_PI); }

const aestheticMachine = (i)=>{ setTimeout(()=>{ let fname = Math.round(Math.random()); let fname2 = Math.round(Math.random()); let fname3 = Math.round(Math.random()); let fname4 = Math.round(Math.random()); let fname5 = Math.round(Math.random()); let fname6 = Math.round(Math.random()); let fname7 = Math.round(Math.random()); widthC = Math.round(getRandomArbitrary(0,1920)); heightC = Math.round(getRandomArbitrary(0,1080)); canvasX = Math.round(getRandomArbitrary(0,1920)); canvasY = Math.round(getRandomArbitrary(0,1080)); canvas.position(canvasX, canvasY); resizeCanvas(widthC, heightC); download(`${fname.toString()}${fname2.toString()}${fname3.toString()}${fname4.toString()}${fname5.toString()}${fname6.toString()}${fname7.toString()}`); unplugButton.style.marginRight= `${Math.round(getRandomArbitrary(0,1920))}px`; unplugButton.style.marginLeft= `${Math.round(getRandomArbitrary(0,1920))}px`; unplugButton.style.marginTop= `${Math.round(getRandomArbitrary(0,1080))}px`; unplugButton.style.fontSize = `${getRandomArbitrary(0,72)}px` body.style.backgroundColor = `rgb(${getRandomArbitrary(0,255)},${getRandomArbitrary(0,255)},${getRandomArbitrary(0,255)})`; texto.style.fontSize = `${getRandomArbitrary(0,72)}px` console.log("El ancho ahora es", widthC); console.log("El largo ahora es", heightC); console.log("Margen Derecho", unplugButton.style.marginRight); },1000 * (i + 1)) };

const getRandomArbitrary= (min, max)=> { return Math.random() * (max - min) + min; } for(let i = 0; i <= randomNumber(); i++){ aestheticMachine(i); }