<community>of XML and SVG Developers</community>
This is a discussion on path problems within the SVG Questions forums, part of the SVG Forums category; hello all I am having some trouble getting my head around the functionality associated with paths. in this example I ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| I am having some trouble getting my head around the functionality associated with paths. in this example I am using the animateTransform scale function in an attempt to scale a path so that on the screen it stays in one location and its size increases. <svg width="100%" height="100%"> <g transform="translate(120 80)"> <path d="M153 334 C153 334 151 334 151 334 C151 339 153 344 156 344 C164 344 171 339 171 334 C171 322 164 314 156 314 C142 314 131 322 131 334 C131 350 142 364 156 364 C175 364 191 350 191 334 C191 311 175 294 156 294 C131 294 111 311 111 334 C111 361 131 384 156 384 C186 384 211 361 211 334 C211 300 186 274 156 274" style="fill:white;stroke:red;stroke-width:2"> <animateTransform attributeType="XML"attributeName="transform" type="scale" from="0" to="3" dur="5s" fill="freeze"/> </path> </g> </svg> using a path (above) I am unable to get this result as the path moves diagonally down across the screen as the grid is scaled, however when using a circle (copy and paste the circle code in italics below in place of path to see result) instead of a path I am able to get the result i am after (scales and remains in the same place on the screen) <circle cx="0" cy="0" r="50" fill="none" stroke-width="15" stroke="#ff00ff" stroke-opacity="0.8"> <animateTransform attributeType="XML" attributeName="transform" type="scale" from="0" to="3" dur="5s" fill="freeze"/> </circle> Please could someone explain why I get one result when using a path and another different when using a circle and perhaps suggest a solution. If anyone has a solution to the final posting in my previous query entitled animateColor I would also be very grateful Thank you kindly for your assistance with my path dilemmas mo |
| |||
|
It's not problem with path or circle ... Scale is always centered in 0,0 As your circle's center is 0,0 you get what you want. For path, your path begin in 153,334 in scale(3) begining point become 459, 1002, so you see some translation ... To correct you can change your path as d="M0 0 ................" and put it in place using transform in g element You can also use relative coordinates in d so only first point must be changed .. Another solution is to put transform in your path as <g transform="translate(273 414)"> <path transform="translate(-153 -334)" d="M153 334 ....... and in animateTransform add additive="sum" Michel |
| |||
|
Sorry ... I forget that in ASV, transform from animateTransform is apply BEFORE transform defined in element ... If you keep your d, you have to use two animateTransform ... This run fine : <g transform="translate(273 414)"> <path transform="translate(-153 -334)" d="M153 334 C153 334 151 334 151 334 C151 339 153 344 156 344 C164 344 171 339 171 334 C171 322 164 314 156 314 C142 314 131 322 131 334 C131 350 142 364 156 364 C175 364 191 350 191 334 C191 311 175 294 156 294 C131 294 111 311 111 334 C111 361 131 384 156 384 C186 384 211 361 211 334 C211 300 186 274 156 274" style="fill:white;stroke:red;stroke-width:2"> <animateTransform attributeType="XML" attributeName="transform" type="scale" from="0" to="3" dur="10s" fill="freeze"/> <animateTransform attributeType="XML" attributeName="transform" additive="sum" type="translate" from="-153,-334" to="-153,-334" dur="10s" fill="freeze"/> </path> </g> Michel |
Canon Ink Cartridges...
Canon ink cartridges are much cheaper here.
ink jet
Think ink jet ink. Think internet ink. Great value, great brands, great service. Order online to take advantage of our magnificent range!
hard disk drive repair recovery manchester
Data Clinic's hard disk drive data recovery and repair success lead to satisfied customers. We are easy to find in Manchester.