Can I somehow get the center of rotation for an object from the XML file, or by javascript / svg commands? I need to programmatically (by javascript) rotate object created in inkscape. To be able to rotate it correctly I need to specify pivot (center of rotation) eg.calling JS function obj.setAttribute( "transform","rotate(angle, x, y)"); I need to know the correct x and y for my object.
Anyone can help?
P.S.: I have tried to derive center of rotation from the bounding box center, but this method does not work for objects rotated and scaled/ translated.
how to get center of rotation?
- shawnhcorey
- Posts: 149
- Joined: Mon Jan 07, 2008 12:17 pm
Re: how to get center of rotation?
It's been awhile since I did anything like this but you have to translate the centre of the object to the origin (0,0), rotate it, then translate it back.