<community>of XML and SVG Developers</community>
This is a discussion on Rotation problems within the SVG Questions forums, part of the SVG Forums category; Hello all, I am new to SVG and have been working on a project for an interface design class. My ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| My problem. I have built a buttons into the interface that allow the shapes clicked to be rotated in increments 20 degrees. I have experimented with the matrix(cox(radian), sin(radian),-sin(radian),cos(radian),0,0) and also the rotate(degrees,x,y). Both will roate my shape, but after it has been rotated the coordinate system is also rotated! When I then try to drag the shape, my drag function works with unpredicatable results to say the least. :shock: Different angles cause the movement to be different. Is there any was to translate the entire coordinate system back the the original non-rotated x/y grid so I can move my shape after it has been rotated?? Any help would be greatly appreciated - this has me stumped, but I am far from an SVG guy! :cry: Here is the interface - sorry the code is messy, it needs rewritten after I figure out SVG. :lol: http://marble.sru.edu/~mrb6558/427/SVG/tiler.html |
| |||
|
You can 1 - center your shapes at origin 2 - allow rotation on your shape around origin 3 - by drag and drop add translate in transform attribute example <rect x="-10" y="-10" width="20" height="20" transform="translate(50 50) rotate(20)" ..../> You can also put shape in group if you don't want to parse transform attribute : <g transform="translate(50 50)"> <rect x="-10" y="-10" width="20" height="20" transform="rotate(20)" ..../> </g> when user drag and drop shape, you modify only group parent translate when user rotate shape, you modify only rotate in shape Michel See example http://pilat.free.fr/tiling_loc/tile.svg |
| |||||
|
That is a really cool example. The way shapes are made is hard to understand in the code. They loop and add rect objects. Kind of neat. The problem is I can't center me shapes at the origin because the I want them to appear where the user clicks when say for example the "triangle" button is depressed. Here is how I create my triangle... Quote:
Quote:
Quote:
Quote:
Quote:
http://marble.sru.edu/~mrb6558/427/SVG/tiler2.html Any help would be greatly - greatly appreciated. I thought I would have solved this a long time ago. The funny part is someone who knows SVG could probably rewrite it to work in an hour. :lol: Oh well, I might work on it more this summer after it is due just for my own benefit and satisfaction. I hate turning in code that is half done. Thanks in advance for any help! ~Matt |
Printer Ink Cartridge
Buy your printer ink cartridge from this online company and save.
brother ink
Order Brother ink from us to get value for money. We even provide fully guaranteed compatible alternatives! Longer lasting.
Hard Disk Drive Data Recovery North West
Professional data recovery! Professional service! Visit the above link.