xxxxxxxxxx
function setup() {
// Step 1: Create a canvas that is 400 pixels wide and 400 pixels tall.
createCanvas(600, 600);
// Set the background color to dark blue using RGB values.
background(0, 0, 100);
// Set the color for our dots to white.
fill(200);
// Decide the size of each dot and how much space will be between them.
let dotSize = 5;
let spacing = 20;
// Start the position of the first dot in the grid.
let startX = 100;
let startY = 100;
// Use a loop to draw multiple rows of dots.
// This outer loop handles the vertical (y-axis) positioning of each row.
for (let y = startY; y <=350 ; y += spacing) {
// For each row, we use another loop to draw each dot horizontally (x-axis).
for (let x = startX; x <=350 ; x += spacing) {
// Draw a dot at the position (x, y) with the specified size (dotSize).
ellipse(x, y, dotSize, dotSize);
}
}
}