Code your way _Week3-1
Thu Feb 09 2023 02:45:29 GMT+0000 (Coordinated Universal Time)
Saved by
@yc_lan
//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);
}
content_copyCOPY
Comments