processing/p5.js

How to change color of all circles??

Closed this issue · 2 comments

Topic

I would like to add color(any color I want) of whole dot while I test with 'for' loops example.
so, Is there an any solution for applying color of all circles??

function setup() {
createCanvas(600, 600);
}

function draw() {
background(240);
let space = 10;
strokeWeight(4);

for (let x = space; x < 600; x += space) {
// Loop from the top to the bottom.
for (let y = space; y < 600; y += space) {
point(x, y);
}
}
}

Screen Shot 2024-05-13 at 5 16 28 PM

Hi @yealicjswo you can use the stroke() function like the below:

function setup() {
  createCanvas(600, 600);
}

function draw() {
  background(240);
  let space = 10;
  strokeWeight(4);
  stroke(255, 0, 0);

  for (let x = space; x < 600; x += space) {
    // Loop from the top to the bottom.
    for (let y = space; y < 600; y += space) {
      point(x, y);
    }
  }
}

If you need help with your own code, please direct your questions to the forum or Discord. We use GitHub issues mainly for bug reports and feature requests only. Thanks!

@limzykenneth thanks! I will make sure to ask an question(for my own code) in the forum and Discord.