Cannot center rectangle

The rectMode(CENTER) cannot center my rectangle in my canvas. How do I fix this?

1 Like

Use this command rectMode(CENTER) before rect() please

Welcome to the forum!

2 Likes

Or show your code please

please play

void setup() {
  size(100, 100);
  rectMode(CENTER); // test also disable with // 
  fill(0, 200, 200);
  stroke(0, 200, 0);
  strokeWeight(3);
}
void draw() {
  background(200, 200, 0);
  for ( int d = 90; d > 1; d -= 10 )  rect(width/2, height/2, d, d);
}

https://processing.org/reference/rectMode_.html
https://processing.org/reference/rect_.html

1 Like