rect(0, 0, width, height);
rotate(PI/2 + PI/2);
rect(0, 0, 100, 400);
If I understand correctly, translate(500,500) will translate (0,0) into position (500,500). rotate(PI/2 + PI/2) will rotate the coordinate system clock-wise for PI radians, then a rectangle with respect to this new coordinate system is drawn, with center (0,0), width and height 100 and 400. When I tried the above code, I did see the rectangle, it disappeared and then with a black screen. Could anyone please let me know how to understand this?
Actually, translate(500,500) turns (0,0) into (-500,-500). The translate function moves the graph over by the amount specified(500 right, 500 down). To get the results you are looking for, change
Also, the rectangle is black.
Use background() at start of draw() to set a background.
You are filling entire sketch window with a rect() that is black and drawing a rect() that is black over it.
Set different colors with fill() before each shape to see them.