
Originally posted by MacDev_ed:
...current version of SVG. I find that thing about CSS styling of the transform attribute a bit weird, I don't see that as something you generally style. Transforms don't really follow the CSS cascading rules, transforms are multiplied together, they're not inherited. And what would happen in an example like this:
<svg>
<style>
g { transform: rotate(45); }
</style>
<g transform="translate(10,10)">
<g transform="skewX(10)">
</g>
</g>
</svg>
Should the style transform be replaced on the <g> element(s), or should they be multiplied together, and in that case in which order, pre- or post-multiplication?
The border between what's semantics and what's presentation is a bit fuzzy for svg since it's a graphics format.
By the CSS rules that would have to be equivalent to
<svg>
<g transform="rotate(45)">
<g transform="rotate(45)">
</g>
</g>
</svg> I would expect the selector to be a little more specific than
g in real life (e.g. I needed it for the digits, which had a specific class), but there is another problem, which is probably the showstopper. A 'transform' CSS property could be considered a shorthand for a '
transform-rotate', '
transform-translate' and so on. '
transform-rotate' would only override rotate transformations, but no other transformations. But the order matters,
rotate(45) translate(10,10) is different from
translate(10,10) rotate(45), CSS couldn't handle that.
In my view linear transformations are presentational/projections in nature. A circle viewed from a different angle would appear as an ellipsis, but it would still be a circle in nature.
There are many other CSS properties missing in action. For the digital clock for instance '
border-*' would be very useful, even more so for more fluid text. I miss the flexibility of HTML/CSS layouts in SVG.
Originally posted by MacDev_ed:
You are aware of the syntax for rotating around a point, no? You can use this: transform="rotate(deg x y)"
(x,y) is the centerpoint of the rotation and deg is the rotation in degrees. I'm not sure if that was what you were looking for, but it is very useful.
Immediately I thought that would be a better solution, but then I realised it is not the same. What the clock uses is really a translation, not a rotation. What I would have needed would be something like
translate(length degree). Of course I could have used trigonometry to set the precise x,y coordinates, but it would be less readable and all the coordinates would have to be re-calculated if using a different sized disc. By
rotate(deg) translate(radius) rotate(-deg) it would be sufficient to change the radius.
Post edited Tuesday, 23. January 2007, 09:24:07