xxxxxxxxxx
13
function setup() {
createCanvas(200, 200);
stroke(0, 200, 0); // Green stroke color.
push(); // Save the original unrotated coordinate system with origin top left.
strokeWeight(5); // 5 pixel stroke width.
stroke(200, 0, 0); // Red stroke color.
translate(100, 50); // Move the origin to (100, 50)
rotate(PI / 4); // Rotate coordinate system by PI/4 radians (45 degrees).
scale(2, 2); // Double the scale.
rect(0, 0, 50, 50); // Draw a red diamond with thick lines.
pop(); // Restore the original drawing styles and coordinate system.
rect(5, 5, 50, 50); // Draw a green square with a thin lines in the top left corner.
}