regarding scripting improvements
Today I tryied (again) to animate an SVG using javascript. I wanted to simply move a star by offseting its x,y coordinates on screen. So, I created a star in Inkscape and then opened the SVG in Firefox. Looking at the xml (using FireBug) I noticed that d attribute of the star uses absolute coordinates. Thus, it is not practical to change it's position dinamically since I would have to set transform:translate(x-x0,y-y0) guessing the correct values of x0 and y0.
It would be much better (for scripting purposes) to have shapes always created with relative coordinates around (0,0) and then translated to x0,y0 using the transform attribute. The x0,y0 coordinate should be the rotation center of the object (which is represented by a little cross in inkscape ui)
Maybe we should modify sp_svg_write_path to do that. Or maybe create a sp_svg_write_path_relative. Or maybe there is a better place in the code where we could place the proposed new behaviour... I am just guessing. Please tell me what you think about it.
Juca
On Thu, Jan 29, 2009 at 3:35 PM, Felipe Sanches <felipe.sanches@...400...> wrote:
Maybe we should modify sp_svg_write_path to do that. Or maybe create a sp_svg_write_path_relative. Or maybe there is a better place in the code where we could place the proposed new behaviour... I am just guessing. Please tell me what you think about it.
If you really need that, the most logical place is the optimized/preserved transform option that we already have. You will probably need a third option there, "preserved starting from 0,0", and for the implementation, just track how the existing options are implemented (I think the most important function is sp_item_write_transform) and add your new case, probably as a subcase of the "preserved".
participants (2)
-
bulia byak
-
Felipe Sanches