xxxxxxxxxx
35
// Vivianna Mo
// Code! Fall 2021
// Assignment 3 - 10Print
let x = 0;
let y = 0;
let spacing = 20;
function setup() {
createCanvas(600, 500);
background(0);
// colorMode(HSB, 120);
}
function draw() {
stroke(255);
if (random(2) < 0.9) { //when the random# is less than 0.9, a circle will be drawn
noStroke();
circle(x, y, random(2, 10));
// for(i = 0; i <= 360; i++) { // this was for HSB
// let hue = i;
// }
fill(random(255), random(255), random(255));
// fill(i, random(100), 360);
} else { //if it is not less than, then a line will be drawn
stroke('#6cd8eb');
line(x + spacing, y + spacing, x, y);
}
x = x + spacing; //uniform spacing between the lines/circles
if (x > width) { //when it reaches the width, restart the grid
x = 0;
y = y + spacing;
}
}