The pivot property is a bit confusing. Imagine the following example: your rod is a screw located somewhere on the object (it can, of course, also be located somewhere outside, but just for a better understanding, imagine that your object is a wooden board with a screw sticking out) . Your position (graphics / container) is a screw. The object always rotates around the position, but you can change the hinge (the position of the screw on the wood board) on the object, so this will be the new pivot point for the object. Finally, you can try to screw a wooden board to the screw.
In principle, the default values ββand the rotation axis are 0. Therefore, if you have your object, for example, here:
test.drawRoundedRect(100, 100, 200, 200,12);
Now you can try to rotate it, and you will see that it rotates around the point (0,0).
Graphics always revolve around a position; you can try to find it somewhere else:
test.position.x = 200; test.position.y = 200;
Now the object rotates around a point (200,200). But this is only a shift. Now we can try to change the pivot point (which is the fork) to any other position. So, on a wooden board, you just place a screw (50.50), then (100,100), etc., and you will see that it affects the position of your object.
Now, for our example, we can set the anchor point (200,200) in the same coordinates as the position of the object.
test.pivot.x = 200; test.pivot.y = 200;
And finally, it rotates around the center point of the drawn object.
The solution provided by @Spencer is an alternative to the pivot property.