I want to rotate e.g. a svg-rect around a certain point without using transform-origin, say only using chained translates and (origin-)rotates.
Due to my research I found out you do that this way:
- translate the rotation point to the origin
- rotate
- redo (1), say translate it back
but when I use
transform="translate(-100, -50) rotate(30) translate(100, 50)"
it turns out to be rendered at the wrong position compared to
transform="rotate(30, 100, 50)"
I have made a fiddle for this: http://jsfiddle.net/VYmrX/. The blue rect is the original rect, the green one is for comparison and the red one is transformed with the approach from above. I want it to be rotated around its center (100, 50).
How can I obtain that without using the transform-origin?