Why the rectMode() cannot affect how rectangle is created in createShape()?
in
Programming Questions
•
2 months ago
Hi, guys, I am beginner of Processing. I am trying to figure out how the function
createShape works. And it seems like the
rectMode only has effect on the function
rect(), or am I missing something? Below it's a small test I made, it shows exactly what i am talking about.
So can anybody tell me how to change the rectMode in createShape()? Thx alot!!!!
PShape rect;
void setup() {
size(300, 300, P2D);
background(100);
rectMode(CENTER);
}
void draw() {
fill(0, 255, 255);
rect(150, 150, 140, 140);
fill(255, 255, 255);
rect = createShape(RECT, 150, 150, 140, 140);
shape(rect);
}
void setup() {
size(300, 300, P2D);
background(100);
rectMode(CENTER);
}
void draw() {
fill(0, 255, 255);
rect(150, 150, 140, 140);
fill(255, 255, 255);
rect = createShape(RECT, 150, 150, 140, 140);
shape(rect);
}
1