We are about to switch to a new forum software. Until then we have removed the registration on this forum.
dear coders,
i want to rotate each rectangle inside my for-loop. But with this code the programm rotates the whole sketch-matrix. What do i do wrong?
for (int x = 0; x < width; x=x+20) {
for (int y = 0; y < height; y=y+20) {
pushMatrix();
rotate(radians(5));
rect(x,y,20,20);
popMatrix();
}
}
Answers
Hi, you need first to translate the center of the rotation with translate(x/2,y/2) Check here https://processing.org/reference/rotate_.html
Perfect! That worked fine! Thank you J_D !