xxxxxxxxxx
31
function setup() {
createCanvas(600, 600);
colorMode(HSB, 360, 100, 100);
background(0, 0, 100);
//CHANGE AMOUNT BY ADJUSTING CONSTANT BELOW
let cellSize = floor(width / 40);
for(let x = 0; x < width; x+=cellSize){
for(let y = 0; y < height; y+=cellSize){
randomLine(x, y, cellSize, cellSize);
}
}
}
function randomLine(x, y, width, height){
//50% chance
strokeWeight(2);
let leftToRight = random(1) <= 0.5;
if(leftToRight){
stroke(360, 70, 100);
line(x, y, x+width, y+height);
} else {
stroke(200, 70, 100);
line(x+width, y, x, y+height);
}
}
function draw() {
//looping code
}