//nest loop //let variable=random(1) //if<0.5 else let gridsize; function setup() { createCanvas(windowWidth, windowHeight); } function draw() { gridsize=width/10 let x; let y; for(x=0;x<width;x+=gridsize){ for(y=0;y<height;y+=gridsize){ let seed=random(1); noStroke(); if (seed<0.5){ fill (0); }else{ fill(255); } rect(x,y,gridsize)} } noLoop(); } function windowResized() { resizeCanvas(windowWidth, windowHeight); }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter